package me.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
/**
* Created by kekekekekeshi on 17-7-12.
*/
public class DealAction extends ActionSupport {
private String num1;
private String num2;
private String check;
private double num3;
public void setNum1(String num1){
this.num1 = num1;
}
public void setNum2(String num2){
this.num2 = num2;
}
public void setCheck(String check){
this.check = check;
}
public String getNum1(){
return this.num1;
}
public String getNum2(){
return this.num2;
}
public String getCheck(){
return this.check;
}
public String execute(){
String x = getNum1();
String y = getNum2();
double num4 = Double.parseDouble(x);
double num5 = Double.parseDouble(y);
System.out.println(num4);
if(check.equals("+")){
num3 = num4+num5;
}else if(check.equals("-")){
num3 = num4-num5;
}else if(check.equals("*")){
num3 = num4*num5;
}else{
num3 = num4/num5;
}
ActionContext.getContext().getSession().put("num3",num3);
return SUCCESS;
}
}
Struts2的简单计算Demo
需积分: 9 61 浏览量
2017-07-12
14:15:38
上传
评论
收藏 7MB GZ 举报
可可可可KE是
- 粉丝: 19
- 资源: 8
最新资源
- 演讲稿.txt
- 基于Python的爬虫案例-软科中国大学TOP200
- 碳排放权交易明细数据(2024年5月更新).xlsx
- 特殊文件属性命令chattr和lsattr
- HTML、CSS 和 JavaScript动态、交互式的网页 .txt
- b0cd8f9b23d4e5e381b6a8fd8ee0e907.JPG
- ff45d61c5900e45634cf4cac6cff61a1.JPG
- springboot.springboot.springboot.springboot.txt
- linux-进程与服务管理
- 毕业设计基于Django+MySQL+Redis实现简单的天气预报系统python源码.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈