showshoppingcart.jsp
来自「100多M的J2EE培训内容」· JSP 代码 · 共 99 行
JSP
99 行
<%@ page contentType="text/html; charset=EUC_CN" %>
<%@ page info="JavaCamp.com - ShowShoppingCartt.jsp " import="java.util.Vector, sfsbsample.ScheduleVO" %>
<html>
<title>Chapter 18: J2EE Online Registration Application</title>
<body>
<center>
<h2>Chapter 18: J2EE Online Registration Application </h2>
<table border="5">
<caption><font size="4">Shopping Cart Contents</font></caption>
<tr>
<th>Schedule ID</th>
<th>Course Title</th>
<th>Location</th>
<th>Start Date</th>
<th>End Date</th>
<th>Cost</th>
<th> Status </th>
<th>Action</th>
</tr>
<%
Vector vList = (java.util.Vector) request.getAttribute("vec");
if (!vList.isEmpty())
{
double sum = 0.0;
%>
<b> List </b> <%=vList.size()%>
<%
try
{
for( int i=0; i < vList.size(); i++ )
{
ScheduleVO schedule = (ScheduleVO) vList.elementAt(i);
sum = sum + schedule.getCost();
%>
<tr>
<td><%=schedule.getScheduleID()%></td>
<td><%=schedule.getCourseTitle()%></td>
<td><%=schedule.getLocation()%></td>
<td><%=schedule.getStartDate()%></td>
<td><%=schedule.getEndDate()%></td>
<td>$ <%=schedule.getCost()%></td>
<td><%=schedule.getStatus()%></td>
<td>
<Form Action="shoppingcartclient" method="POST">
<input type="hidden" name="requestAction" value="DeleteASchedule">
<input type="hidden" name="ScheduleID" value="<%= schedule.getScheduleID() %>">
<input type="submit" value="Remove this item">
</form>
</td>
</tr>
<%
}
%>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td>Total</td>
<td> sum </td>
<td>$ <%=sum%> </td>
<td> </td>
<td>
<Form Action="shoppingcartclient" method="POST">
<input type="hidden" name="requestAction" value="EmptyMyScheduleList">
<input type="submit" value="Empty the cart">
</form>
<Form Action="shoppingcartclient" method="POST">
<input type="hidden" name="requestAction" value="CheckOut">
<input type="submit" value="Check Out">
</form>
</td>
</tr>
<%
} catch(Exception e) {
System.out.println(" ******* exception "+e);
}
%>
</table>
<%
} else {
%>
<h3>Your shopping Cart is empty!</h3>
<%
}
%>
<a href="/WebApp3/shop.html">Search for Java training classes</a>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?