可以用,用method 指定就好了
@Action(value = "findAllAction" ,results = {@Result(name = "success" , location = "list.jsp")})
public String findAll(){
List<Customer> list = customerService.findAll();
session.put("list", list);
return SUCCESS;
}
@Action(value = "loginAction" ,results = {@Result(name = "success" , location = "list.jsp")})
public String login(){
List<Customer> list = customerService.findAll();
session.put("list", list);
return SUCCESS;
}
@Action(value = "findAllAction" ,results = {@Result(name = "success" , location = "list.jsp")})
public String findAll(){
List<Customer> list = customerService.findAll();
session.put("list", list);
return SUCCESS;
}
@Action(value = "loginAction" ,results = {@Result(name = "success" , location = "list.jsp")})
public String login(){
List<Customer> list = customerService.findAll();
session.put("list", list);
return SUCCESS;
}
配置文件
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<constant name="struts.i18n.encoding" value="UTF-8" /> <package name="cus" namespace="/" extends="struts-default">
<!-- action name="customerAction" class="com.zuxiang.action.Login" method="findAll" >
<result name="success">/list.jsp</result>
</action -->
<action name="customerAction2" class="com.zuxiang.action.Login" method="login">
<result name="success">/index.jsp</result>
</action>
</package>
</struts>
method="{1}">
<result name="input">student{1}.jsp</result>
<result name="success">success.jsp</result>
</action>
你在页面要返回regisert就action="student_regisert",其他方法同理,这样已经最简单了
<action name="student_*" class="WU.WEBTutor.Action.StudentAction"
method="{1}">
<result name="input">${result}</result>
<result name="success">success.jsp</result>
</action>
result就是你返回的页面,