The
JSP Implementation page Calculator code is as follows: Only two JSP pages
mycal.jsp are 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" >
Although the process is simple but there are several places worth learning:
How to judge the input data is not a number: using Math.Round (form1.num1.value)!= form1.num1.value to judge;
How to get action values: Set the Name property flag implementation.
I hope this article will help you learn about JSP programming.