arithexpservlet.java

来自「java web 开发,Java Xml 编程指南书籍源码」· Java 代码 · 共 51 行

JAVA
51
字号
// servlet Xml2DBS, which sets up commands for the
// Xml2DBTables class

import javax.servlet.*;  // communicate with client
import javax.servlet.http.*; 

import MyNa.utils.Logger;  // saves admin/debug info to file

import MyNa.utils.Env;   // basic package
import MyNa.utils.EnvServlet; // for setStr.
import MyNa.utils.MiscFile;   // basic package

import MyNa.utils.HtmlWrapper; // sends HTML to client.
import java.io.IOException; // thrown by HtmlWrapper
import MyNa.utils.MiscDate; // for logging.
import MyNa.xml.XmlArithEval;



public class ArithExpServlet extends EnvServlet { 
  String filePath = "MyNa/Xml2DBS/"; // C:\JRun\jsm-default\MyNa\Xml2DBS
  String topFileName = "top.htm";  // these are not used now, but may be
  String ctlFileName = "ctl.htm"; // future template/session controls.
  Logger lg;

  public void doGet (HttpServletRequest req, 
                     HttpServletResponse res)
          throws ServletException, IOException{
    doPost(req,res);
  }

  public void doPost (HttpServletRequest req, 
                     HttpServletResponse res)
          throws ServletException, IOException{
    res.setContentType("text/html");
    HtmlWrapper W=new HtmlWrapper(res.getWriter());
    lg=new Logger(); 
    try{
      XmlArithEval xae=new XmlArithEval(new Env(req));
      xae.doIt();
      String floatResult=xae.getFloatResult();
      W.wrapPage("XmlArithEval ","produced "+floatResult);
    }catch(Exception ex){
      W.wrapPage("doPost failure",""+ex);}
  }


}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?