struts2拦截器应用wait

来源:互联网 发布:php finally 编辑:程序博客网 时间:2024/05/22 12:28

登录页面,点击登录,可以跳转到一个信息提示页面,显示说后台处理中,请稍候。。。。。。,过了几秒钟,刷新页面,检测到后台处理结束,就正常跳转,没结束,在等到页面继续等待刷新

struts.xml配置:

<constant name="struts.i18n.encoding" value="GBK"></constant>

<package name="test" extends="struts-default" namespace="/">

<action name="login" class="cn.action.LoginAction">

<result name="success" type="dispatcher">/main.jsp

</result>

<result name="error" type="dispatcher">/loginFail.jsp

</result>

<result name="wait">/wait.jsp</result>

<interceptor-ref name="defaultStack"></interceptor-ref>

<interceptor-ref name="execAndWait"></interceptor-ref>

</action>

</package>

wait.jsp等待页面:

<head>

  <meta http-equiv="refresh" content="2;url=login.action">

  </head>  

  <body>

请稍候,后台正在处理......

  </body>

注意:2拦截器顺序不可乱;刷新页面url不是wait.jsp

原创粉丝点击