
order.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor=#eeeeee>
<font size="3">
<form action=orderR.jsp method="post">
<table border="1">
<tr>
<th width="100">货号
<th width="100">单价
<th width="50">数量
</tr>
<tr>
<td><input type="hidden" name="No" value="p001">p001 </td>
<td><input type="hidden" name="price" value="24">24 </td>
<td><input type="text" name="num" value=""></td>
</tr>
<tr>
<td><input type="hidden" name="No" value="p002">p002 </td>
<td><input type="hidden" name="price" value="18">18</td>
<td><input type="text" name="num" value=""></td>
</tr>
<tr>
<td><input type="hidden" name="No" value="p003">p003</td>
<td><input type="hidden" name="price" value="35">35</td>
<td><input type="text" name="num"value=""></td>
</tr>
</table>
<input type="submit" value="提交">
</form>
</font>
</body>
</html>
```html
orderR.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path=request.getContextPath();
String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html >
<head>
<base href="<%=basePath%>">
<meta charset="UTF-8">
<title>My JSP 'orderR.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keywords1,keywords2,keywords3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css"
-->
</head>
<body>
<table border="1">
<tr>
<th width="100">货号
<th width="100">单价
<th width="50">数量
<th width="50">总价
</tr>
<tr>
<td><input type="hidden" name="No" value="p001">p001 </td>
<td><input type="hidden" name="price" value="24">24 </td>
<td><c:out value="${param.num1}"></c:out></td>
<td><%String num1=request.getParameter("num1");
if(num1=="num1"){
num1="1";
int n1=Integer.parseInt(num1);
out.println(n1*24);
}
else{
int n1=Integer.parseInt(num1);
out.println(n1*24);
}
%></td>
</tr>
<tr>
<td><input type="hidden" name="No" value="p002">p002 </td>
<td><input type="hidden" name="price" value="18">18 </td>
<td><c:out value="${param.num2}"></c:out></td>
<td>${param.num2*24} </td>
</tr>
<tr>
<td><input type="hidden" name="No" value="p003">p0023</td>
<td><input type="hidden" name="price" value="35">35</td>
<td><c:out value="${param.num3}"></c:out></td>
<td>${param.num3*24}</td>
</tr>
</table>
</body>
</html>