display the button value
This commit is contained in:
Binary file not shown.
@ -17,9 +17,10 @@ public class _calculator__jsp extends com.caucho.jsp.JavaPage
|
|||||||
javax.servlet.http.HttpServletResponse response)
|
javax.servlet.http.HttpServletResponse response)
|
||||||
throws java.io.IOException, javax.servlet.ServletException
|
throws java.io.IOException, javax.servlet.ServletException
|
||||||
{
|
{
|
||||||
|
javax.servlet.http.HttpSession session = request.getSession(true);
|
||||||
com.caucho.server.webapp.WebApp _jsp_application = _caucho_getApplication();
|
com.caucho.server.webapp.WebApp _jsp_application = _caucho_getApplication();
|
||||||
javax.servlet.ServletContext application = _jsp_application;
|
javax.servlet.ServletContext application = _jsp_application;
|
||||||
com.caucho.jsp.PageContextImpl pageContext = _jsp_application.getJspApplicationContext().allocatePageContext(this, _jsp_application, request, response, null, null, 8192, true, false);
|
com.caucho.jsp.PageContextImpl pageContext = _jsp_application.getJspApplicationContext().allocatePageContext(this, _jsp_application, request, response, null, session, 8192, true, false);
|
||||||
javax.servlet.jsp.PageContext _jsp_parentContext = pageContext;
|
javax.servlet.jsp.PageContext _jsp_parentContext = pageContext;
|
||||||
javax.servlet.jsp.JspWriter out = pageContext.getOut();
|
javax.servlet.jsp.JspWriter out = pageContext.getOut();
|
||||||
final javax.el.ELContext _jsp_env = pageContext.getELContext();
|
final javax.el.ELContext _jsp_env = pageContext.getELContext();
|
||||||
@ -29,6 +30,31 @@ public class _calculator__jsp extends com.caucho.jsp.JavaPage
|
|||||||
request.setCharacterEncoding("Big5");
|
request.setCharacterEncoding("Big5");
|
||||||
try {
|
try {
|
||||||
out.write(_jsp_string0, 0, _jsp_string0.length);
|
out.write(_jsp_string0, 0, _jsp_string0.length);
|
||||||
|
|
||||||
|
String inputdata = request.getParameter("symbol");
|
||||||
|
|
||||||
|
if(inputdata == null) {
|
||||||
|
|
||||||
|
|
||||||
|
out.write(_jsp_string1, 0, _jsp_string1.length);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
try{
|
||||||
|
//int data = Integer.parseInt(inputdata);
|
||||||
|
out.println(inputdata);
|
||||||
|
|
||||||
|
out.write(_jsp_string2, 0, _jsp_string2.length);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(NumberFormatException e) {
|
||||||
|
throw new NumberFormatException("\ufffd\u523b\u6493\ufffd\u4ea6\ufffd\ufffd\u929d\ufffd\ufffd\u8200\ufffd\u6e54\ufffd\ufffd");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
out.write(_jsp_string3, 0, _jsp_string3.length);
|
||||||
} catch (java.lang.Throwable _jsp_e) {
|
} catch (java.lang.Throwable _jsp_e) {
|
||||||
pageContext.handlePageException(_jsp_e);
|
pageContext.handlePageException(_jsp_e);
|
||||||
} finally {
|
} finally {
|
||||||
@ -102,12 +128,18 @@ public class _calculator__jsp extends com.caucho.jsp.JavaPage
|
|||||||
String resourcePath = loader.getResourcePathSpecificFirst();
|
String resourcePath = loader.getResourcePathSpecificFirst();
|
||||||
mergePath.addClassPath(resourcePath);
|
mergePath.addClassPath(resourcePath);
|
||||||
com.caucho.vfs.Depend depend;
|
com.caucho.vfs.Depend depend;
|
||||||
depend = new com.caucho.vfs.Depend(appDir.lookup("calculator.jsp"), 1898269132803111951L, false);
|
depend = new com.caucho.vfs.Depend(appDir.lookup("calculator.jsp"), 3495430881658896476L, false);
|
||||||
com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend);
|
com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static char []_jsp_string0;
|
private final static char []_jsp_string0;
|
||||||
|
private final static char []_jsp_string1;
|
||||||
|
private final static char []_jsp_string3;
|
||||||
|
private final static char []_jsp_string2;
|
||||||
static {
|
static {
|
||||||
_jsp_string0 = "\n<html>\n <head>\n <title> Calculator </title>\n </head>\n\n <body>\n <form action=\"calculator.jsp\" method=post>\n <p>\n <input name=\"display\">\n <br>\n <input name=\"%\" type=\"submit\" value=\"%\">\n <input name=\"root\" type=\"submit\" value=\"root\">\n <input name=\"square\" type=\"submit\" value=\"square\">\n <input name=\"reciprocal\" type=\"submit\" value=\"reciprocal\">\n <br>\n <input name=\"CE\" type=\"submit\" value=\"CE\">\n <input name=\"C\" type=\"submit\" value=\"C\">\n <input name=\"X\" type=\"submit\" value=\"X\">\n <input name=\"/\" type=\"submit\" value=\"/\">\n <br>\n <input name=\"7\" type=\"submit\" value=\"7\">\n <input name=\"8\" type=\"submit\" value=\"8\">\n <input name=\"9\" type=\"submit\" value=\"9\">\n <input name=\"*\" type=\"submit\" value=\"*\">\n <br>\n <input name=\"4\" type=\"submit\" value=\"4\">\n <input name=\"5\" type=\"submit\" value=\"5\">\n <input name=\"6\" type=\"submit\" value=\"6\">\n <input name=\"-\" type=\"submit\" value=\"-\">\n <br>\n <input name=\"1\" type=\"submit\" value=\"1\">\n <input name=\"2\" type=\"submit\" value=\"2\">\n <input name=\"3\" type=\"submit\" value=\"3\">\n <input name=\"+\" type=\"submit\" value=\"+\">\n <br>\n <input name=\"+-\" type=\"submit\" value=\"+-\">\n <input name=\"0\" type=\"submit\" value=\"0\">\n <input name=\".\" type=\"submit\" value=\".\">\n <input name=\"=\" type=\"submit\" value=\"=\">\n \n \n \n \n \n \n </p>\n </form>\n </body>\n</html>".toCharArray();
|
_jsp_string0 = "\n<html>\n <head>\n <title> Calculator </title>\n </head>\n\n <body>\n <p>Calculator</p>\n ".toCharArray();
|
||||||
|
_jsp_string1 = "\n\n <form action=\"calculator.jsp\" method=post>\n <p>\n <input name=\"display\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"%\">\n <input name=\"symbol\" type=\"submit\" value=\"root\">\n <input name=\"symbol\" type=\"submit\" value=\"square\">\n <input name=\"symbol\" type=\"submit\" value=\"reciprocal\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"CE\">\n <input name=\"symbol\" type=\"submit\" value=\"C\">\n <input name=\"symbol\" type=\"submit\" value=\"X\">\n <input name=\"symbol\" type=\"submit\" value=\"/\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"7\">\n <input name=\"symbol\" type=\"submit\" value=\"8\">\n <input name=\"symbol\" type=\"submit\" value=\"9\">\n <input name=\"symbol\" type=\"submit\" value=\"*\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"4\">\n <input name=\"symbol\" type=\"submit\" value=\"5\">\n <input name=\"symbol\" type=\"submit\" value=\"6\">\n <input name=\"symbol\" type=\"submit\" value=\"-\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"1\">\n <input name=\"symbol\" type=\"submit\" value=\"2\">\n <input name=\"symbol\" type=\"submit\" value=\"3\">\n <input name=\"symbol\" type=\"submit\" value=\"+\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"+-\">\n <input name=\"symbol\" type=\"submit\" value=\"0\">\n <input name=\"symbol\" type=\"submit\" value=\".\">\n <input name=\"symbol\" type=\"submit\" value=\"=\">\n </p> \n </form>\n\n ".toCharArray();
|
||||||
|
_jsp_string3 = " \n </body>\n</html>".toCharArray();
|
||||||
|
_jsp_string2 = "\n <form action=\"calculator.jsp\" method=post>\n <p>\n <input name=\"display\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"%\">\n <input name=\"symbol\" type=\"submit\" value=\"root\">\n <input name=\"symbol\" type=\"submit\" value=\"square\">\n <input name=\"symbol\" type=\"submit\" value=\"reciprocal\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"CE\">\n <input name=\"symbol\" type=\"submit\" value=\"C\">\n <input name=\"symbol\" type=\"submit\" value=\"X\">\n <input name=\"symbol\" type=\"submit\" value=\"/\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"7\">\n <input name=\"symbol\" type=\"submit\" value=\"8\">\n <input name=\"symbol\" type=\"submit\" value=\"9\">\n <input name=\"symbol\" type=\"submit\" value=\"*\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"4\">\n <input name=\"symbol\" type=\"submit\" value=\"5\">\n <input name=\"symbol\" type=\"submit\" value=\"6\">\n <input name=\"symbol\" type=\"submit\" value=\"-\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"1\">\n <input name=\"symbol\" type=\"submit\" value=\"2\">\n <input name=\"symbol\" type=\"submit\" value=\"3\">\n <input name=\"symbol\" type=\"submit\" value=\"+\">\n <br>\n <input name=\"symbol\" type=\"submit\" value=\"+-\">\n <input name=\"symbol\" type=\"submit\" value=\"0\">\n <input name=\"symbol\" type=\"submit\" value=\".\">\n <input name=\"symbol\" type=\"submit\" value=\"=\">\n </p> \n </form>\n ".toCharArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,12 @@ JSP
|
|||||||
+ 1 calculator.jsp
|
+ 1 calculator.jsp
|
||||||
calculator.jsp
|
calculator.jsp
|
||||||
*L
|
*L
|
||||||
1#1:31
|
1#1:32
|
||||||
50#1:32
|
9#1,6:33
|
||||||
|
14#1:39
|
||||||
|
52#1,8:40
|
||||||
|
59#1:48
|
||||||
|
95#1,8:49
|
||||||
|
102#1:57
|
||||||
|
104#1:58
|
||||||
*E
|
*E
|
||||||
|
124
calculator.jsp
124
calculator.jsp
@ -5,46 +5,100 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<form action="calculator.jsp" method=post>
|
<p>Calculator</p>
|
||||||
<p>
|
<%
|
||||||
<input name="display">
|
String inputdata = request.getParameter("symbol");
|
||||||
<br>
|
|
||||||
<input name="%" type="submit" value="%">
|
|
||||||
<input name="root" type="submit" value="root">
|
|
||||||
<input name="square" type="submit" value="square">
|
|
||||||
<input name="reciprocal" type="submit" value="reciprocal">
|
|
||||||
<br>
|
|
||||||
<input name="CE" type="submit" value="CE">
|
|
||||||
<input name="C" type="submit" value="C">
|
|
||||||
<input name="X" type="submit" value="X">
|
|
||||||
<input name="/" type="submit" value="/">
|
|
||||||
<br>
|
|
||||||
<input name="7" type="submit" value="7">
|
|
||||||
<input name="8" type="submit" value="8">
|
|
||||||
<input name="9" type="submit" value="9">
|
|
||||||
<input name="*" type="submit" value="*">
|
|
||||||
<br>
|
|
||||||
<input name="4" type="submit" value="4">
|
|
||||||
<input name="5" type="submit" value="5">
|
|
||||||
<input name="6" type="submit" value="6">
|
|
||||||
<input name="-" type="submit" value="-">
|
|
||||||
<br>
|
|
||||||
<input name="1" type="submit" value="1">
|
|
||||||
<input name="2" type="submit" value="2">
|
|
||||||
<input name="3" type="submit" value="3">
|
|
||||||
<input name="+" type="submit" value="+">
|
|
||||||
<br>
|
|
||||||
<input name="+-" type="submit" value="+-">
|
|
||||||
<input name="0" type="submit" value="0">
|
|
||||||
<input name="." type="submit" value=".">
|
|
||||||
<input name="=" type="submit" value="=">
|
|
||||||
|
|
||||||
|
if(inputdata == null) {
|
||||||
|
|
||||||
|
%>
|
||||||
|
|
||||||
|
<form action="calculator.jsp" method=post>
|
||||||
|
<p>
|
||||||
|
<input name="display">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="%">
|
||||||
|
<input name="symbol" type="submit" value="root">
|
||||||
|
<input name="symbol" type="submit" value="square">
|
||||||
|
<input name="symbol" type="submit" value="reciprocal">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="CE">
|
||||||
|
<input name="symbol" type="submit" value="C">
|
||||||
|
<input name="symbol" type="submit" value="X">
|
||||||
|
<input name="symbol" type="submit" value="/">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="7">
|
||||||
|
<input name="symbol" type="submit" value="8">
|
||||||
|
<input name="symbol" type="submit" value="9">
|
||||||
|
<input name="symbol" type="submit" value="*">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="4">
|
||||||
|
<input name="symbol" type="submit" value="5">
|
||||||
|
<input name="symbol" type="submit" value="6">
|
||||||
|
<input name="symbol" type="submit" value="-">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="1">
|
||||||
|
<input name="symbol" type="submit" value="2">
|
||||||
|
<input name="symbol" type="submit" value="3">
|
||||||
|
<input name="symbol" type="submit" value="+">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="+-">
|
||||||
|
<input name="symbol" type="submit" value="0">
|
||||||
|
<input name="symbol" type="submit" value=".">
|
||||||
|
<input name="symbol" type="submit" value="=">
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
try{
|
||||||
|
//int data = Integer.parseInt(inputdata);
|
||||||
|
out.println(inputdata);
|
||||||
|
%>
|
||||||
|
<form action="calculator.jsp" method=post>
|
||||||
|
<p>
|
||||||
|
<input name="display">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="%">
|
||||||
|
<input name="symbol" type="submit" value="root">
|
||||||
|
<input name="symbol" type="submit" value="square">
|
||||||
|
<input name="symbol" type="submit" value="reciprocal">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="CE">
|
||||||
|
<input name="symbol" type="submit" value="C">
|
||||||
|
<input name="symbol" type="submit" value="X">
|
||||||
|
<input name="symbol" type="submit" value="/">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="7">
|
||||||
|
<input name="symbol" type="submit" value="8">
|
||||||
|
<input name="symbol" type="submit" value="9">
|
||||||
|
<input name="symbol" type="submit" value="*">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="4">
|
||||||
|
<input name="symbol" type="submit" value="5">
|
||||||
|
<input name="symbol" type="submit" value="6">
|
||||||
|
<input name="symbol" type="submit" value="-">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="1">
|
||||||
|
<input name="symbol" type="submit" value="2">
|
||||||
|
<input name="symbol" type="submit" value="3">
|
||||||
|
<input name="symbol" type="submit" value="+">
|
||||||
|
<br>
|
||||||
|
<input name="symbol" type="submit" value="+-">
|
||||||
|
<input name="symbol" type="submit" value="0">
|
||||||
|
<input name="symbol" type="submit" value=".">
|
||||||
|
<input name="symbol" type="submit" value="=">
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
catch(NumberFormatException e) {
|
||||||
|
throw new NumberFormatException("您輸入的不是整數");
|
||||||
|
}
|
||||||
|
|
||||||
</p>
|
}
|
||||||
</form>
|
%>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Reference in New Issue
Block a user