⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calculate.jsp

📁 Hibernate开发及整合应用大全 蔡雪焘编著 本书用典型的示例剖析Hibernate开发中的重点和难点
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" %>
<jsp:useBean id="calculator" scope="request" class="ch12_5.MyCalculator">
<jsp:setProperty name="calculator" property="*"/>
</jsp:useBean>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form action="calculate.jsp" method=get>
<table width="75%" border="1" >
  <tr>
    <td>第一个参数</td>
    <td><input type=text name="one"></td>
  </tr>
 <tr>
    <td>操作符</td>
    <td><select name="operator">
	         <option value="+">+</option>
			<option value="-">-</option>
			<option value="*">*</option>
			<option value="/">/</option>
	    </select>
	</td>
  </tr>
  <tr>
    <td>第二个参数</td>
    <td><input type=text name="two"></td>
  </tr>
  <tr>   
    <td colspan="2" ><input type=submit value=计算></td>
  </tr>
</table>
</form>
计算结果:<% 
try
{

calculator.calculate();
out.println(calculator.getOne()+calculator.getOperator()+calculator.getTwo()+"="+calculator.getResult());
}
catch(Exception e)
{
out.println(e.getMessage());
}
%>
</body>
</html>

⌨️ 快捷键说明

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