• 大小: 4.39MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-15
  • 语言: Java
  • 标签: JS  

资源简介

JSP实现的计算器,基于MVC模式的计算器。适合新手学习!

资源截图

代码片段和文件信息

package com.wfs.action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.wfs.entity.Calculator;

public class CalAction extends ActionSupport implements ModelDriven{
 private Calculator cal=new Calculator();
    public Calculator getCal() {
        return cal;
    }
    public void setCal(Calculator cal) {
        this.cal = cal;

    }
    public String calculator() throws Exception{
      float result=0;
         switch(cal.getOperator().charAt(0)){
         case ‘+‘:result=cal.getNum1()+cal.getNum2();break;
         case ‘-‘:result=cal.getNum1()-cal.getNum2();break;
         case ‘*‘:result=cal.getNum1()*cal.getNum2();break;
         case ‘/‘:result=cal.getNum1()/cal.getNum2();
         }
         ActionContext.getContext().put(“result“ result);
        return SUCCESS;
    }
@Override
public Calculator getModel() {
// TODO Auto-generated method stub
return cal;
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        840  2018-10-08 08:56  20180929_wfs_calculator\.classpath

     文件        923  2018-10-08 08:56  20180929_wfs_calculator\.project

     文件        567  2018-10-08 08:56  20180929_wfs_calculator\.settings\.jsdtscope

     文件        408  2018-10-08 08:56  20180929_wfs_calculator\.settings\org.eclipse.jdt.core.prefs

     文件        521  2018-10-08 08:56  20180929_wfs_calculator\.settings\org.eclipse.wst.common.component

     文件        344  2018-10-08 08:56  20180929_wfs_calculator\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2018-10-08 08:56  20180929_wfs_calculator\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2018-10-08 08:56  20180929_wfs_calculator\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       1688  2018-10-17 17:47  20180929_wfs_calculator\build\classes\com\wfs\action\CalAction.class

     文件       1293  2018-10-17 17:47  20180929_wfs_calculator\build\classes\com\wfs\action\CalAction2.class

     文件        928  2018-10-17 17:47  20180929_wfs_calculator\build\classes\com\wfs\entity\Calculator.class

     文件        831  2018-10-08 11:11  20180929_wfs_calculator\build\classes\struts.xml

     文件       1056  2018-10-08 10:58  20180929_wfs_calculator\src\com\wfs\action\CalAction.java

     文件        841  2018-10-08 10:58  20180929_wfs_calculator\src\com\wfs\action\CalAction2.java

     文件        494  2018-10-08 11:11  20180929_wfs_calculator\src\com\wfs\entity\Calculator.java

     文件        831  2018-10-08 11:11  20180929_wfs_calculator\src\struts.xml

     文件        998  2018-10-08 11:13  20180929_wfs_calculator\WebContent\Calculator.jsp

     文件         39  2018-10-08 08:56  20180929_wfs_calculator\WebContent\meta-INF\MANIFEST.MF

     文件        442  2018-10-08 09:54  20180929_wfs_calculator\WebContent\Success.jsp

     文件      70604  2018-09-26 22:32  20180929_wfs_calculator\WebContent\WEB-INF\lib\commons-fileupload-1.3.3.jar

     文件     208700  2018-09-26 22:32  20180929_wfs_calculator\WebContent\WEB-INF\lib\commons-io-2.5.jar

     文件     494856  2018-09-26 22:32  20180929_wfs_calculator\WebContent\WEB-INF\lib\commons-lang3-3.6.jar

     文件    1496146  2018-09-26 22:32  20180929_wfs_calculator\WebContent\WEB-INF\lib\freemarker-2.3.26-incubating.jar

     文件     750581  2018-09-26 22:32  20180929_wfs_calculator\WebContent\WEB-INF\lib\javassist-3.20.0-GA.jar

     文件     255485  2018-09-26 22:32  20180929_wfs_calculator\WebContent\WEB-INF\lib\log4j-api-2.10.0.jar

     文件     235459  2018-09-26 22:32  20180929_wfs_calculator\WebContent\WEB-INF\lib\ognl-3.1.15.jar

     文件    1635849  2018-09-26 22:32  20180929_wfs_calculator\WebContent\WEB-INF\lib\struts2-core-2.5.17.jar

     文件        631  2018-10-08 09:00  20180929_wfs_calculator\WebContent\WEB-INF\web.xml

     目录          0  2018-10-20 20:08  20180929_wfs_calculator\build\classes\com\wfs\action

     目录          0  2018-10-20 20:08  20180929_wfs_calculator\build\classes\com\wfs\entity

............此处省略18个文件信息

评论

共有 条评论