summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp
diff options
context:
space:
mode:
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp')
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/catalog.jsp44
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/clearQuote.jsp15
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/emptyQuote.jsp15
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/error.jsp11
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/footer.jsp5
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/login.jsp70
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/productInfo.jsp32
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/receipt.jsp19
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/showQuote.jsp87
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/title.jsp8
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/wsf.jsp22
11 files changed, 328 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/catalog.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/catalog.jsp
new file mode 100644
index 0000000..92ccf8d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/catalog.jsp
@@ -0,0 +1,44 @@
+<%-- This JSP Retrieves products vector from HttpSession and displays in table format.
+ The product details includes name the product and its base price. User can view the
+ product details by clicking on name of the product. User can also add a product to
+ the shopping cart by clicking on add to cart link. When user clicks on add to cart
+ link, item is added to the cart and displays same at the bottom of the screen.
+
+--%>
+<%@ page import="examples.shop.impl.entity.Product" %>
+<html>
+ <head><title> Jasmine's Catalog page </title></head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <h3><A HREF="/jasmine/showQuote">View Current Shopping Cart</A></h3>
+ <h3>Please choose from our selections</h3>
+ <center><table>
+ <%
+ //Retrieves catalog vector from HTTPSession and displays product item details in a table format
+ session = request.getSession(false);
+ java.util.Vector products=(java.util.Vector)session.getAttribute("products");
+ int size=products.size();
+ Product item=null;
+ for(int i=0; i<size;i++){
+ item=(Product)products.elementAt(i);
+ %>
+ <tr>
+ <td bgcolor="#ffffaa"><a href="/jasmine/catalog?productId=<%=item.getProductID()%>"><b><%=item.getName()%><b></td>
+ <td align="right" bgcolor="#ffffaa"><%=item.getBasePrice()%></td>
+ <td bgcolor="#ffffaa"> <A HREF="/jasmine/catalog?Buy=<%=item.getProductID()%>"> Add to Cart</A></td>
+ </tr>
+ <%}%>
+ </table></center>
+ <P>
+ <%
+ // Displays the name of the product item added to the cart, at the bottom of the page.
+ String productName = (String) request.getAttribute("ProductPurchased");
+ if (productName != null) {
+ %>
+ <i> <%=productName%></i> has been added to your shopping cart.
+ <% } %>
+
+ <jsp:include page="footer.jsp" />
+
+ </body>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/clearQuote.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/clearQuote.jsp
new file mode 100644
index 0000000..0c13d29
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/clearQuote.jsp
@@ -0,0 +1,15 @@
+<%-- When user clicks on clear cart button, servlet forwards request to this jsp --%>
+<html>
+ <head><title>Jasmine's Clear Cart page</title></head>
+
+ <BODY>
+ <jsp:include page="title.jsp" />
+ <font size="+2"><strong>You just cleared your Cart!</strong></font>
+ <br>&nbsp;
+ <br>
+ <center>
+ <a href="/jasmine/wsf.jsp">Back to the main page</a>
+ </center>
+ <jsp:include page="footer.jsp" />
+ </BODY>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/emptyQuote.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/emptyQuote.jsp
new file mode 100644
index 0000000..f0779bd
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/emptyQuote.jsp
@@ -0,0 +1,15 @@
+<%-- If shopping cart is empty and user clicks on shopping cart link, servlet forwards request to this jsp --%>
+<html>
+ <head><title> Jasmine's Empty Cart page</title></head>
+ <BODY>
+ <jsp:include page="title.jsp" />
+ <font size="+2">Your Cart is empty.</font>
+ <br>&nbsp;
+ <br>
+ <center>
+ <a href="/jasmine/wsf.jsp">Back to the web storefront.</a>
+ </center>
+ <jsp:include page="footer.jsp" />
+
+ </BODY>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/error.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/error.jsp
new file mode 100644
index 0000000..47aaca8
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/error.jsp
@@ -0,0 +1,11 @@
+<%-- JSP container forwards request to this jsp, if any exceptions in processing --%>
+<html>
+ <head><title> Jasmine's Error page </title></head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <p>Error in processing your request.
+ <p>Please contact System Administrator
+ <p><i><a href="/jasmine/wsf.jsp">Click here to return to the main page.</a></i>
+ </body>
+</html>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/footer.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/footer.jsp
new file mode 100644
index 0000000..2df4e29
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/footer.jsp
@@ -0,0 +1,5 @@
+<%-- Diplays Footer --%>
+<hr>
+<i>&copy; 2004-2006, Jasmine's Computer Parts, Inc., All rights reserved.</i>
+<br>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/login.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/login.jsp
new file mode 100644
index 0000000..8d773b3
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/login.jsp
@@ -0,0 +1,70 @@
+<%--
+ This JSP displays a login screen. When the user fills out the login
+ screen, it will submit it to the Login Servlet, which will verify the
+ user's credentials by calling EJB components.
+
+ If the verification is unsuccessful, the login servlet will return
+ the user to this page to re-enter his credentials.
+
+ If the verification is successful, Jasmine's main page will be displayed.
+--%>
+
+<html>
+<head>
+ <title>Jasmine's Login page </title>
+</head>
+
+<body>
+
+<%-- Include the title, which is "Jasmine's Computer Parts"--%>
+<jsp:include page="title.jsp" />
+
+<%-- Indicate the error page to use if an error occurs --%>
+<jsp:directive.page errorPage="error.jsp" />
+
+<%-- Display the login form --%>
+<h4>Please enter login information</h4>
+<p>
+<form action="/jasmine/login" method="get">
+ <table>
+ <tr>
+ <td><b>Name:</b></td>
+ <td>
+ <input type="text" name="Login" size="19"/>
+ </td>
+ </tr>
+ <tr>
+ <td><b>Password:</b></td>
+ <td>
+ <input type="text" name="Password" size="19"/>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" value="Submit Information"/>
+ <input type="submit" value="Register"/>
+ </td>
+ </tr>
+ </table>
+</form>
+
+<%
+ // get whether the person logged in successfully
+ Boolean failed = (Boolean) request.getAttribute("loginFailed");
+ if (failed != null) {
+ if (failed.booleanValue() == true) {
+%>
+ <p>
+ <strong>Could not log in! Please try again.</strong>
+ <p>
+<%
+ }
+ }
+%>
+
+<%-- Include the page footer --%>
+<jsp:include page="footer.jsp" />
+
+</body>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/productInfo.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/productInfo.jsp
new file mode 100644
index 0000000..e18ea8a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/productInfo.jsp
@@ -0,0 +1,32 @@
+<%--This JSP displays details of the selected product.
+ Customer can add this item to the shopping cart by clicking on add to cart link.
+ Customer has provision to navigate to the catalog as well as to the shopping cart pages.
+ --%>
+<%@ page import="examples.shop.impl.entity.Product" %>
+
+<html>
+ <head><title> Jasmine's Product Info page</title></head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <jsp:directive.page errorPage="error.jsp" />
+
+ <%
+ //Retrieves the productItem from request object and displays.
+ Product item=(Product)request.getAttribute("productItem");
+ %>
+
+ <b><%=item.getName()%><b>
+ <h4> Description:</h4>
+ <%=item.getDescription()%>
+ <h4>Base price (before discounts):<%=item.getBasePrice()%></h4>
+
+ <center>
+ <A href="/jasmine/catalog?Buy=<%=item.getProductID()%>">Add this item to Cart</A><br>
+ <A href="/jasmine/catalog">See the Catalog</A><br>
+ <A href="/jasmine/showQuote">View Current Shopping Cart</A>
+
+ <jsp:include page="footer.jsp" />
+
+ </center>
+ </body>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/receipt.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/receipt.jsp
new file mode 100644
index 0000000..448a26b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/receipt.jsp
@@ -0,0 +1,19 @@
+<%--This JSP displays order confirmation. When user clicks on order button,
+ Order will be created in the database and order confirmation number will be
+ displayed to the customer.
+ --%>
+<html>
+ <head><title> Jasmine's Order Confirmation page </title></head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <jsp:directive.page errorPage="error.jsp" />
+ <%-- Retrieves Order Id from request object and displays.--%>
+ <h3>Thank you for shopping with us.
+ <p>Your order number is <%=request.getAttribute("orderID")%>
+ <p>Please shop with us again soon!
+ </h3>
+ <p><i><a href="/jasmine/wsf.jsp">Click here to return to the main page.</a></i>
+ <jsp:include page="footer.jsp" />
+ </body>
+</html>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/showQuote.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/showQuote.jsp
new file mode 100644
index 0000000..d01abbb
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/showQuote.jsp
@@ -0,0 +1,87 @@
+<%--
+ This JSP displays details of the products added to the cart.
+ The details includes the name of the product, quantity, base price,
+ discount and total price of each line item. It also displays subtotal,
+ taxes and grand total of the entire cart. Customer has provision to
+ modify the quantities, order the contents and clear the cart.
+
+--%>
+<HTML>
+ <head><title> Jasmine's Shopping Cart page </title></head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <jsp:directive.page errorPage="error.jsp" />
+ <%@ page import="examples.shop.impl.entity.Product" %>
+ <%@ page import="examples.shop.impl.entity.LineItem" %>
+ <%@ page import="java.util.List" %>
+ <%@ page import="java.util.Iterator" %>
+ <%@ page import="java.text.NumberFormat" %>
+ <form action="/jasmine/showQuote" method="get">
+ <center><table>
+ <tr>
+ <th align=left> Name </TH>
+ <th align=left> Quantity </TH>
+ <th align=left> Individual Base Price </TH>
+ <th align=left> Discount </TH>
+ <th align=left><strong> Total Price </strong></TH>
+ </tr>
+ <%
+ // get the lineItems from the request object and displays in a table format.
+ List<LineItem> lineItems = (List<LineItem>)request.getAttribute("lineItems");
+ double subTotal=((Double)request.getAttribute("subTotal")).doubleValue();
+ double taxes=((Double)request.getAttribute("taxes")).doubleValue();
+ double taxRate=((Double)request.getAttribute("taxRate")).doubleValue();
+ double total=((Double)request.getAttribute("total")).doubleValue();
+
+ for(Iterator<LineItem> iter = lineItems.iterator(); iter.hasNext();) {
+ LineItem li = iter.next();
+ int quantity = li.getQuantity();
+ double discount = li.getDiscount();
+ Product product = li.getProduct();
+ String productID = product.getProductID();
+ double basePrice = product.getBasePrice();
+ %>
+ <tr>
+ <td bgcolor="#ffffaa"><a href="/jasmine/catalog?productId=<%=product.getProductID()%>"><b><%=product.getName()%><b></td>
+ <td><input type="text" name="<%=productID%>" value="<%=quantity%>"></td>
+ <td bgcolor="#ffffaa" align="right"><%=basePrice%></td>
+ <td bgcolor="#ffffaa" align="right"><%=discount%></td>
+ <td bgcolor="#ffffaa" align="right"><%=basePrice*quantity-discount%></td>
+
+ </tr>
+ <% } %>
+ </table></center>
+ <br>
+ <center><table>
+ <tr>
+ <td colspan="2" align="right" bgcolor="#ffffff"> Subtotal:</td>
+ <td bgcolor="#ffffaa" align="right"><%=subTotal%></td>
+ <td> <br></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="right" bgcolor="#ffffff">Sales Tax: </td>
+ <td bgcolor="#ffffaa" align="right"><%=taxes%></td><td align="right">(<%=taxRate%>)%</td>
+ <td><br></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="right" bgcolor="ffffff"> <font color="ff0000"> <strong>Grand Total:</strong></font> </td>
+ <td bgcolor="#ffffaa" align="right"><%=total%></td>
+ <td><br></td>
+ </tr>
+ </table></center>
+ <!--
+ Print out links and buttons for user feedback.
+ When the customer clicks a button to perform an
+ action (such as submitting an order), sends request to
+ the servlet with necessary parameters to process the request.
+ //-->
+ <p>
+ <A href="/jasmine/catalog">See the Catalog</A>
+ <input type="submit" name="Update" value="Update Quantities"> &nbsp; &nbsp; &nbsp;
+ <input type="submit" name="Order" value="Submit Order"> &nbsp; &nbsp; &nbsp;
+ <input type="submit" name="Clear" value="Clear Cart"> &nbsp; &nbsp; &nbsp;
+
+ <jsp:include page="footer.jsp" />
+ </form>
+ </body>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/title.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/title.jsp
new file mode 100644
index 0000000..afaaea1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/title.jsp
@@ -0,0 +1,8 @@
+<%-- Diplays title --%>
+<hr>
+<p>
+ <center>
+ <h1>Jasmine's Computer Parts</h1>
+ </center>
+</p>
+<hr> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/wsf.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/wsf.jsp
new file mode 100644
index 0000000..de589f1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/wsf.jsp
@@ -0,0 +1,22 @@
+<%--
+ This JSP page displays Jasmine's main screen.
+ Customers can navigate to the catalog as well as
+ to the shopping cart page.
+--%>
+
+<html>
+ <head>
+ <title>Jasmine's Main page</title>
+ </head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <jsp:directive.page errorPage="error.jsp" />
+
+ <h3><A href="/jasmine/catalog"><b>Catalog</b></A></h3>
+ <h4><p> Choose from our excellent selection of computer parts.</p><br></h4>
+ <h3><A href="/jasmine/showQuote"><b>Shopping Cart</b></A></h3>
+ <h4><p> Look at your shopping cart to see the equipment you've chosen.</p></h4>
+
+ <jsp:include page="footer.jsp" />
+ </body>
+</html>