标签:
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="avoidPackage" extends="struts-default"> <action name="avoid" class="struts2.action.AvoidAction"> <interceptor-ref name="token"></interceptor-ref> <interceptor-ref name="defaultStack"></interceptor-ref> <result name="invalid.token">/error.jsp</result> <result name="input">/input.jsp</result> <result name="success">/output.jsp</result> </action> </package> </struts>
public class AvoidAction extends ActionSupport { private static final long serialVersionUID = 2676453800249807631L; private String username; private Date birthday; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } @Override public String execute() { try { Thread.sleep(4000); } catch (InterruptedException e) { e.printStackTrace(); } return SUCCESS; } }
<s:form action="avoid"> <s:token> </s:token> <s:textfield name="username" label="Enter your name"></s:textfield> <s:textfield name="birthday" label="Enter your birthday"></s:textfield> <s:submit value="submit"> </s:submit> </s:form>
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="avoidPackage" extends="struts-default"> <action name="avoid" class="struts2.action.AvoidAction"> <interceptor-ref name="tokenSession"></interceptor-ref> <interceptor-ref name="defaultStack"></interceptor-ref> <result name="invalid.token">/error.jsp</result> <result name="input">/input.jsp</result> <result name="success">/output.jsp</result> </action> </package> </struts>
版权声明:感觉我写的还算不错的的话希望你能够动动你的鼠标和键盘为我点上一个赞或是为我奉献上一个评论,在下感激不尽!_______________________________________________________欢迎转载,希望在你转载的同时,添加原文地址,谢谢配合
标签:
原文地址:http://blog.csdn.net/u011225629/article/details/48009675