首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

统制重复提交

2012-09-13 
控制重复提交//index.jspform actionuser methodpostname:input namenameage:input namea

控制重复提交

//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;}}

热点排行