Struts2返回結果類型

轉自:http://blog.csdn.net/sleeping_/article/details/6583425

Struts2提供了對不同種類返回結果的支持,常見的有JSP,FreeMarker,Velocity等。

struts.xml配置文件中result的語法:<result name="" type="">xxxxx</result>

Struts2支持的不同類型的返回結果爲:

Chain Result-->type="chain"
用來處理Action鏈

Dispatcher Result -->type="dispatcher"
用來轉向頁面,通常處理JSP

FreeMarker Result -->type="freemarker"
處理FreeMarker模板

HttpHeader Result -->type="httpheader"
用來控制特殊的Http行爲

Redirect Result -->type="redirect"
重定向到一個URL

Redirect Action Result -->type="redirectAction"
重定向到一個Action

Stream Result -->type="stream"
向瀏覽器發送InputSream對象,通常用來處理文件下載

Velocity Result -->type="velocity"
處理Velocity模板

XLST Result -->type="xslt"
處理XML/XLST模板

PlainText Result -->type="plainText"
顯示原始文件內容,例如文件源代碼
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章