控制重复提交
//index.jsp<form action="user" method="post">name:<input name="name">age:<input name="age"><input type="submit" value="add"><s:token></s:token> <!-- 添加token,防止重复提交 --></form>
//struts.xml<constant name="struts.i18n.encoding" value="GBK" /> <!-- internationalization --><package name="test" namespace="/" extends="struts-default"><action name="input" name="code">//actionpackage com.bjsxt.action;import com.opensymphony.xwork2.ActionSupport;@SuppressWarnings("serial")public class InputAction extends ActionSupport {@Overridepublic String execute() throws Exception {return super.execute();}}package com.bjsxt.action;import com.opensymphony.xwork2.ActionSupport;@SuppressWarnings("serial")public class UserAction extends ActionSupport {private String name;private int age;@Overridepublic String execute() throws Exception {System.out.println("a user added!");return super.execute();}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}}