ShowShoppingCart.jsp~5~
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:2k
源码类别:
Java编程
开发平台:
Java
- <%@ 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="ShopAlias" method="POST">
- <input type="hidden" name="requestAction" value="EmptyMyScheduleList">
- <input type="submit" value="Empty the cart">
- </form>
- <Form Action="ShopAlias" 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.htm">Search for Java training classes</a>
- </center>
- </body>
- </html>