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";
}
}struts中的代码是<?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>在输入的操作数大于0的时候,也会跳转到负数的界面,小于0时还是负数界面。不能根据求和结果正确跳转!!!
急急急,javaee小白求助各位大神!!!!strutsjavaee
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";
}
}struts中的代码是<?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>在输入的操作数大于0的时候,也会跳转到负数的界面,小于0时还是负数界面。不能根据求和结果正确跳转!!!
急急急,javaee小白求助各位大神!!!!strutsjavaee
解决方案 »
- 如何刷百度指数?
- Java新手将去面试求助有经验的过来人
- com.mysql.jdbc.exceptions.MySQLSyntaxErrorException错误
- 问题~the method setCharacterEncoding(string) is undefined for the type HttpServletResponse
- 问各位牛人一个问题,关于java项目开发
- ClassPathXmlApplicationContext 载入多个配置文件问题
- ////////////////////////////////spring2.X + hibernate3.X ////////////////////////
- 请大家帮忙看看 一个hibernate问题?
- 分页提问
- Hibernate的查询问题请教
- SSH报ora-1400 无法将NULL插入 ....
- 来个比较唬人的j2ee毕业设计题目~
{
if(sum>0)
return "ZS";
else return "FS";
}把sum>0改为getSum()>0就行了
一个小的Demo也急,真是的