首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

Wait拦截器(execAndWait)亲善提示

2012-08-29 
Wait拦截器(execAndWait)友好提示前台表单提交登录请求(login.jsp, login.action,wait.jsp)login.jsp for

Wait拦截器(execAndWait)友好提示
前台表单提交登录请求(login.jsp, login.action,wait.jsp)

login.jsp

 <form action="login.action" method="post">  username:<input type="text" name="username"><br>  password:<input type="password" name="password"><br>  <input type="submit" value="submit">  </form>


LoginAction正常处理

wait.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%String path = request.getContextPath();//当前页面当时刷新3秒response.setHeader("refresh","3;URL=login.action");String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <base href="<%=basePath%>">        <title>My JSP 'login.jsp' starting page</title>    <!-- 定时刷新3秒,当前页面 --><meta http-equiv="refresh" content="3;URL=login.action">  </head>  <body>  <h1>数据已经提交,正在等待服务器返回信息,请耐心等待。。。。。。</h1>  </body>  </html>


struts.xml
<action name="login" exception="com.test.exception.UsernameException"></exception-mapping><result name="success">/result.jsp</result><result name="usernameInvalid">/usernameInvalid.jsp</result><!-- 这里的name一定要为wait --><result name="wait">/wait.jsp</result><interceptor-ref name="defaultStack"></interceptor-ref><!-- exec拦截器必须在所有拦截器的最后 --><interceptor-ref name="execAndWait"></interceptor-ref></action>

热点排行