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

📄 shoppingcart.jsp

📁 ORACLE AQ sample 演示的如何出列
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page import="oracle.otnsamples.AQ.Helper.Product"%>
<%@ page import="oracle.otnsamples.AQ.Helper.ShoppingCartProduct"%>

<%@ page import="java.util.Hashtable"%>
<%@ page import="java.util.Enumeration"%>

<BODY bgColor=#ffffff  text=#000000>
<form name="ShoppingForm" method="post">
<%
  // Get the available products list.
  Hashtable productsList = (Hashtable)session.getAttribute("ProductsList");

  // Get the customers shopping cart.
  Hashtable shoppingCart = (Hashtable)session.getAttribute("ShoppingCart");
%>
<!-- Main table -->
   <jsp:include page="include/Top.jsp" />
   <SPAN
                    class="greeting"> Hi <%=session.getAttribute("Name")%>. You have logged in as a Customer.</SPAN>
   <jsp:include page="include/Links.jsp" />
        <!-- Heading of the page goes here -->

     <TR><TD class="mainHeading" align="center">Product List</TD></TR>
     <TR><TD>&nbsp;</TD></TR>
     <TR>
        <TD>
            <!-- 5th table starts here working area -->
            <TABLE border=0 cellPadding=0 cellSpacing=0 width=970 >
              <TBODY>
              <TR>
                <TD valign="top" width="15%" noWrap>&nbsp;</TD>
                <TD vAlign=top width="75%">
                  <!-- 6th table starts here-->
                  <TABLE border=1 borderColor="#9BCDFF" cellPadding=2 cellSpacing=0 width="100%">
                    <TBODY>
                    <TR align="center">
                      <TD class="subHeading" width="3%">
                         <input type="checkbox" name="SelectAllProducts" onClick="checkAllProducts();">
                      </TD>
                      <TD class="subHeading" width="2%">S.No</TD>
                      <TD class="subHeading" width="17%">Product Name</TD>
                      <TD class="subHeading" width="8%">Manufacturer Name</TD>
                      <TD class="subHeading" width="47%">Product Description</TD>
                      <TD class="subHeading" width="15%">Category Desc</TD>
                      <TD class="subHeading" width="11%">Price (in Dollars)</TD>
                    </TR>

                    <%
                        // Get all the keys stored in the Hashtable in an Enumeration.
                        Enumeration enumProduct = productsList.keys();

                        // Initialize Serial Number
                        int serialNo = 0;

                        // Iterate through the Hashtable
                        while (enumProduct.hasMoreElements()){
                          Object key = enumProduct.nextElement();
                          serialNo++;

                          // Get the first Product from the Hashtable and display it
                          Product product = (Product)productsList.get(key);
                    %>

                    <TR align="center" height="25">
                      <TD class="data">
                        <input type="checkbox" name="ProductsToSell" value="<%=key%>">
                      </TD>
                      <TD class="data"><%=serialNo%></TD>
                      <TD class="data"><%=product.getProductName()%></TD>
                      <TD class="data"><%=product.getManufacturerName()%></TD>
                      <TD class="data"><%=product.getProductDesc()%></TD>
                      <TD class="data"><%=product.getCategoryDesc()%></TD>
                      <TD class="data"><%=product.getProductPrice()%></TD>
                    </TR>

                    <%
                       }
                    %>

                   </TBODY>
                  </TABLE>

            <!-- 6th table ends here -->
                </TD>
                <TD width="10%">&nbsp;</TD>
              </TR>

          <TR>
            <TD colspan=3>&nbsp;</TD>
          </TR>
          <TR>
            <TD colspan=3 align="center"><img src="images/add.gif" border=0 width="60" height="32" onMouseUp="addToSC();"></TD>
          </TR>
          <TR height=10>
            <TD colspan=3>&nbsp;</TD>
          </TR>
          <TR>
            <TD colspan=3><img src=images/brownLine.gif width="970" height="2"></TD>
          </TR>
          <TR height=10>
            <TD colspan=3>&nbsp;</TD>
          </TR>
          <TR><TD colspan=3 class="mainHeading" align="center">Shopping Cart</TD></TR>
              <TR><TD colspan=3>&nbsp;</TD></TR>
              <TR>
                <TD valign="top" width="15%" noWrap>&nbsp;</TD>
                <TD vAlign=top width="75%">
                  <!-- 7th table starts here (shopping cart)-->
                  <TABLE border=1 borderColor="#9BCDFF" cellPadding=2 cellSpacing=0 width="100%">
                    <TBODY>
                    <%
                       // Checks if the Shopping Cart is empty.
                       if (!shoppingCart.isEmpty()){
                    %>
                    <!-- Sets the value if the shopping cart is not empty.
                         This value is used by JavaScript -->
                    <input type="hidden" name="EmptyShoppingCart" value="1">
                    <TR align="center">
                      <TD class="subHeading" width="3%">
                         <input type="checkbox" name="SelectAllCart" onClick="checkAllCart();">
                      </TD>
                      <TD class="subHeading" width="2%">S.No</TD>
                      <TD class="subHeading" width="25%">Product Name</TD>
                      <TD class="subHeading" width="18%">Manufacturer Name</TD>
                      <TD class="subHeading" width="17%">Category Desc</TD>
                      <TD class="subHeading" width="15%">Price</TD>
                      <TD class="subHeading" width="10%">Quantity</TD>
                      <TD class="subHeading" width="13%">Sub total (in Dollars)</TD>
                    </TR>

                    <%
                          // Get all the keys stored in the Hashtable in an Enumeration.
                          Enumeration enumCart = shoppingCart.keys();

                          // Initialize Serial Number
                          int serial = 0;

                          // Iterate through the Hashtable
                          while (enumCart.hasMoreElements()){
                            Object key = enumCart.nextElement();
                            serial++;

                            // Get the first Product from the Hashtable and display it
                            ShoppingCartProduct scProduct = (ShoppingCartProduct)shoppingCart.get(key);
                    %>

                    <TR align="center" height="25">
                      <TD class="data">
                        <input type="checkbox" name="ProductsInSC" value="<%=key%>">
                      </TD>
                      <TD class="data"><%=serial%></TD>

                  <TD class="data"><%=scProduct.getProductName()%></TD>
                      <TD class="data"><%=scProduct.getManufacturerName()%></TD>
                      <TD class="data"><%=scProduct.getCategoryDesc()%></TD>
                      <TD class="data"><%=scProduct.getProductPrice()%></TD>
                      <TD class="data"><input type="text" name="NoOfProducts" maxlength="3" size="3" value="<%=scProduct.getQuantityOrdered()%>"></TD>
                      <TD class="data" align="right"><%=scProduct.getTotalPrice()%></TD>
                    </TR>
                    <%
                          }
                       }else{
                    %>
                    <!-- Sets the value if the shopping cart is empty.
                         This value is used by JavaScript -->
                    <input type="hidden" name="EmptyShoppingCart" value="0">
                         <TR align="center">
                           <TD class="subHeading">
                             No Products are present in your Shopping Cart.
                           </TD>
                         </TR>
                    <%
                       }
                    %>
                   </TBODY>
                  </TABLE>

            <!-- 7th table ends here (shopping cart)-->
                </TD>
                <TD width="10%">&nbsp;</TD>
              </TR>
              <TR><TD colspan=3>&nbsp;</TD></TR>
              <TR>

            <TD colspan=3 align="center"><img src="images/Update.gif" border=0 width="60" height="32"onMouseUp="return updateSC();">
              <img src="images/delete.gif" border=0 width="60" height="32" onMouseUp="deleteFromSC()">
              <img src="images/order.gif" border=0 width="60" height="32" onMouseUp="orderSC()">
            </TD>
              </TR>
              <TR><TD colspan=3>&nbsp;</TD></TR>


              </TBODY>
            </TABLE>
            <!-- 5th table ends here working area-->
        </TD>
      </TR>
      <TR>
        <TD vAlign=top align=left noWrap>&nbsp;</TD>
      </TR>
      <TR>
        <TD vAlign=top align=left ><image src="images/line.gif" height="3" width="970"></TD>
      </TR>
      <TR>
        
    <TD height=19 vAlign=top align="left"><font face="Arial, Helvetica" size=-2> 
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &copy; Copyright 2002 Oracle Corporation. 
      All rights reserved.</font> </TD>
      </TR>
    </TABLE>
    <!-- Main table ends here-->
</form>
</BODY>
</HTML>

⌨️ 快捷键说明

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