(1) JSP implementation of the Web page calculator code is as follows: only two JSP pages
Mycal.jsp as follows:
<%@ page language= "java" import= "java.util.*" pageencoding= "utf-8"%><%string path = Request.getcontextpath () ; String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";%> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
Myresult.jsp as follows:
<%@ page language= "java" import= "java.util.*" pageencoding= "utf-8"%><%string path = Request.getcontextpath () ; String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";%> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
(2) Although the process is simple but there are several places worth learning:
How to tell if the input data is a number: use Math.Round (form1.num1.value)! = Form1.num1.value to judge;
How to get the action value: Set the Name property flag implementation;
JSP Implementation Web Calculator