在配置result中我們常常使用的是預設的型別,也就是dispatcher。
name="success" type="dispatcher">helloworld.jspresult>
redirect是重定向的返回型別,即不會帶引數返回。
name="success" type="redirect">helloworld.jspresult>
chain是鏈條的返回型別,即可實現引數攜帶到下乙個action再次執行。
redirectaction則是直接重定向到乙個action,無法攜帶引數。//將helloworld.jsp替換成另外action的name即可攜帶引數執行另乙個action
"success"
type=
"chain">helloworld.jsp
還有其它不常用的型別在此就不一一贅述,遇到學習即可。
最後介紹一下result的全域性配置,即我們配置乙個action裡面尋找不到result就向上一層尋找的result,這樣可以節省在每乙個action中配置error的問題。
name="first"
extends="struts-default">
name="error">error.jspresult>
global-results>
name="hello_*"
class="com.wood.action.helloworld01"
method="">
name="success"
type="dispatcher">helloworld.jspresult>
action>
package>
struts>
result中的type型別
1 dispatcher 它是預設的,用來轉向頁面,通常處理jsp 2 redirect 將使用者重定向到乙個已配置好的url 3 redirectaction 將使用者重定向到乙個已定義好的action 5 freemarker 呈現freemarker模板 6 httpheader 返回乙個已配...
SpringBoot 全域性異常攔截和日誌配置
作用 springboot中不用關心異常,不用顯示的進行try catch,美觀,正解 擴充套件 可以加到類上,也可以加到類的方法上 關於 的幾點說明 中的 data註解是應用了lombok,需要的話匯入下,也可以刪除註解,自己生成get set和構造方法 json格式化工具用的是fastjson ...
result和break的區別
params year datefield.text nsstring strzero strzero babyheightlabel.text if strzero.length 0 nsstring strone strone babyweightlabel.text if strone.len...