ShowShoppingCart.jsp
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:2k
源码类别:

Java编程

开发平台:

Java

  1. <%@ page contentType="text/html; charset=EUC_CN" %>
  2. <%@ page info="JavaCamp.com - ShowShoppingCartt.jsp " import="java.util.Vector, sfsbsample.ScheduleVO"  %>
  3. <html>
  4. <title>Chapter 18: J2EE Online Registration Application</title>
  5. <body>
  6. <center>
  7. <h2>Chapter 18: J2EE Online Registration Application </h2>
  8. <table border="5">
  9. <caption><font size="4">Shopping Cart Contents</font></caption>
  10. <tr>
  11. <th>Schedule ID</th>
  12. <th>Course Title</th>
  13. <th>Location</th>
  14. <th>Start Date</th>
  15. <th>End Date</th>
  16. <th>Cost</th>
  17. <th> Status </th>
  18. <th>Action</th>
  19. </tr>
  20. <%
  21. Vector vList = (java.util.Vector) request.getAttribute("vec");
  22. if (!vList.isEmpty())
  23. {
  24. double sum = 0.0;
  25. %>
  26. <b> List </b> <%=vList.size()%>
  27. <%
  28. try
  29.       {
  30.    for( int i=0; i < vList.size(); i++ )
  31. {
  32.           ScheduleVO schedule  = (ScheduleVO) vList.elementAt(i);
  33. sum = sum + schedule.getCost();
  34. %>
  35. <tr>
  36. <td><%=schedule.getScheduleID()%></td>
  37. <td><%=schedule.getCourseTitle()%></td>
  38. <td><%=schedule.getLocation()%></td>
  39. <td><%=schedule.getStartDate()%></td>
  40. <td><%=schedule.getEndDate()%></td>
  41. <td>$ <%=schedule.getCost()%></td>
  42. <td><%=schedule.getStatus()%></td>
  43. <td>
  44. <Form Action="shoppingcartclient" method="POST">
  45. <input type="hidden" name="requestAction" value="DeleteASchedule">
  46. <input type="hidden" name="ScheduleID" value="<%= schedule.getScheduleID() %>">
  47. <input type="submit" value="Remove this item">
  48. </form>
  49. </td>
  50. </tr>
  51. <%
  52.          }
  53. %>
  54. <tr>
  55. <td> </td>
  56. <td> </td>
  57. <td> </td>
  58. <td>Total</td>
  59. <td> sum </td>
  60. <td>$ <%=sum%> </td>
  61. <td> </td>
  62. <td>
  63. <Form Action="shoppingcartclient" method="POST">
  64. <input type="hidden" name="requestAction" value="EmptyMyScheduleList">
  65. <input type="submit" value="Empty the cart">
  66. </form>
  67. <Form Action="shoppingcartclient" method="POST">
  68. <input type="hidden" name="requestAction" value="CheckOut">
  69. <input type="submit" value="Check Out">
  70. </form>
  71. </td>
  72. </tr>
  73. <%
  74. } catch(Exception e) {
  75.      System.out.println(" ******* exception "+e);
  76. }
  77. %>
  78. </table>
  79. <%
  80. } else {
  81. %>
  82. <h3>Your shopping Cart is empty!</h3>
  83. <%
  84. }
  85. %>
  86. <a href="/WebApp3/shop.html">Search for Java training classes</a>
  87. </center>
  88. </body>
  89. </html>