日期:2014-05-18 浏览次数:20738 次
import com.opensymphony.xwork2.*; public class RegisterAction extends ActionSupport{ private String username; private String password1; private String password2; public String doRegister() throws Exception{ return "abc"; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword1() { return password1; } public void setPassword1(String password1) { this.password1 = password1; } public String getPassword2() { return password2; } public void setPassword2(String password2) { this.password2 = password2; } }
<?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> <include file="struts-default.xml" /> <constant name="struts.ognl.allowStaticMethodAccess" value="true" /> <package name="user-manage" namespace="/usr" extends="struts-default"> <action name="register" class="com.csjl.infopub.struts2.usr.RegisterAction" method="doRegister"> <result name="input">/usr/register1.jsp</result> <result name="success">/usr/register1.jsp</result> </action> </package> <!-- Add packages here --> </struts>