日期:2014-05-18 浏览次数:20831 次
package Action;
import com.opensymphony.xwork2.ActionSupport;
//import javaBean.add;
public class AddAction extends ActionSupport{
private int ope1;
private int ope2;
private int sum;
public int getOpe1() {
return ope1;
}
public void setOpe1(int ope1) {
this.ope1 = ope1;
}
public int getOpe2() {
return ope2;
}
public void setOpe2(int ope2) {
this.ope2 = ope2;
}
public int getSum() {
return ope1+ope2;
}
public void setSum(int sum) {
this.sum = sum;
}
public String execute() throws Exception
{
if(sum>0)
return "ZS";
else return "FS";
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<package name="action" extends="struts-default" >
<!--包的名称 主要供继承者使用 namespace会作为action访问的一部分,简化代码 -->
<action name="AddAction" class="Action.AddAction" method="execute">
<result name="ZS">/zhengshu.jsp</result>
<result name="FS">/fushu.jsp</result>
</action>
</package>
<!-- Add packages here -->
</struts>
public String execute() throws Exception
&nb