`
ghyghoo8
  • 浏览: 190181 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

struts2--跳转

JSP 
阅读更多
struts2.0的全局跳转  
         <global-results>  
              <result name=”ok”>/ok.jsp</result>  
         </global-results>  
struts2.0的局部跳转:  
            <action name=”login” class=”dd.login”>  
                <result name=”ok”>/ok.jsp</result>  
            </action>  
全局异常:  
   <global-exception-mappings>  
   <exception-mapping result=”error” exception=”java.lang.Exception”/>  
  </global-exception-mappings>  
   要在<global-results>  
          <result name="error">/error.jsp</result>  
       </global-results>  
 
在action中指明该action处理的方法:  
  <action name=”login” class=”xxx.loginAction” method=”login”>  
  <result name=”ok”>/ok.jsp</result>  
  </action>  
-------------------------------------------------
从action1直接跳转到action2,有两种方法:

1. 需要保存前一个action的属性信息时使用:
          <result type= "chain ">action2</result>
2. 不保存前一个action的参数可以用这种方法:
          <result    type= "redirect-action "> ActionName </result>
----------------------------------------------------------------------------
在action中跳转到其他的action  <result name=”ok” type=”chain”>list</result>  
在action中重定向到其他的界面:<result name=”error” type=”redirect”>/error.jsp</result>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics