B.3 The JSP Code for Rosa's System<%-- Page Directives --%> <%@ page import = "java.util.*" %> <%@ page import = "breakfast.ejb.*"%> <%@ page import = "breakfast.ejb.customer.*"%> <%@ page errorPage ="AppError.jsp" %> <%-- Include Directives --%> <%-- Tag Library Directives --%> <%-- Variable and Method declarations --%> <%! Collection CustomerCollection; CustomerDataObject Customer; Iterator it; %> <%-- Actions --%> <jsp:useBean id="CustomerDom" scope="request" class="breakfast.ejb.CustomerDataObjectManager"/> <HTML> <head> <title>moduleseparatorCustomer</title> <link href="css/ApplicationStyle.css" rel="stylesheet" type="text/css" /> </head> <body> <table class="layout-table"> <tr class="layout-row"><td class="layout-cell"> <p> This Page illustrates how a Retrieve is executed on the EJB tier. </p> <p> It is written as pure Jsp, with a connection to basic OptimalJ data-structures. </p> <p></p> <table align="center" border="1" summary=""> <!-- table heading --> <tr> <th align=left><font size="5"><b>Customer</b></font></th> </tr> <tr> <td align=left><font size="3"><b>id</b></font></td> <td align=left><font size="3"><b>address</b></font></td> <td align=left><font size="3"><b>accountNumber</b></font></td> </tr> <!-- table data --> <% // let Remote View Manager retrieve data CustomerCollection = CustomerDom.retrieve(); it = CustomerCollection.iterator(); // iterate collection and write data elements while (it.hasNext()) { Customer = (CustomerDataObject) it.next(); request.setAttribute("Customer", Customer); %> <tr> <td align=left><font size="3"><jsp:getProperty name="Customer" property="id"/></font></td> <td align=left><font size="3"><jsp:getProperty name="Customer" property="address"/></font></td> <td align=left><font size="3"><jsp:getProperty name="Customer" property="accountNumber"/></font></td> </tr> <% } %> </table> <p></p> </td></tr> </table> </body> </HTML> |