Shipping.jsp Sample

This topic inludes the source code for the Shipping.jsp Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_databinding/choice/

Sample Source Code


01 <%@ page language="java" contentType="text/html;charset=UTF-8"%>
02 <%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%>
03 <%@ taglib uri="netui-tags-html.tld" prefix="netui"%>
04 
05 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
06 <html>
07   <head>
08     <title>Shipping</title>
09     <link href="../../../resources/css/style.css" type="text/css" rel="stylesheet"/>
10   </head>
11   <body>
12     <jsp:include page="/resources/jsp/header.jsp"/>
13     
14     <blockquote>
15     <h1>Shipping</h1>
16     <p><b>Product Ship Status</b>
17     <p><netui-data:repeater dataSource="{pageFlow.cart.lineItemList}">
18         <netui-data:repeaterHeader>
19             <table class="table" border=true>
20             <tr class="tablehead"><td>Name</td><td>Shipped Date</td><td>Arrival Date (est)</td></tr>
21         </netui-data:repeaterHeader>
22         <netui-data:repeaterItem>
23         <%--
24         The following netui-data:choiceMethod tag calls the getShippingState method, which 
25         returns one of four values: "inTransit""arrived""notShipped", or "unknown".
26         The four netui-data:choice tags below are used to display four corresponding HTML table rows. 
27         --%>
28             <netui-data:choiceMethod object="{pageFlow}" method="getShippingState">
29                 <netui-data:methodParameter value="{container.item.shipState}"/>
30             </netui-data:choiceMethod>
31             <%--
32             If the call to the method getShippedState returns "inTransit" display this row.
33             --%>
34             <netui-data:choice value="inTransit">
35                 <tr class="row" bgcolor="#ffffcc">
36                     <td><netui:label value="{container.item.name}"/></td>
37                     <td><netui:label value="12/29/2002"/></td>
38                     <td><netui:label value="1/8/2003"/></td>
39                 </tr>
40             </netui-data:choice>
41             <%--
42             If the call to the method getShippedState returns "arrived" display this row.
43             --%>
44             <netui-data:choice value="arrived">
45                 <tr class="row" bgcolor="#ccffcc">
46                     <td><netui:label value="{container.item.name}"/></td>
47                     <td colspan=2><netui:label value="Arrived"/></td>
48                 </tr>
49             </netui-data:choice>
50             <%--
51             If the call to the method getShippedState returns "notShipped" display this row.
52             --%>
53             <netui-data:choice value="notShipped">
54                 <tr class="row" bgcolor="#ffcccc">
55                     <td><netui:label value="{container.item.name}"/></td>
56                     <td colspan=2><netui:label value="Not Yet Shipped"/></td>
57                 </tr>
58             </netui-data:choice>
59             <%--
60             If the call to the method getShippedState returns a value other than the three above,
61             display this row.
62             --%>
63             <netui-data:choice default="true">
64                 <tr class="row">
65                     <td><netui:label value="{container.item.name}"/></td>
66                     <td class="rowerror" colspan=2><netui:label value="Error; status unknown.  Call customer service at 1-800-555-1212"/></td>
67                 </tr>
68             </netui-data:choice>
69         </netui-data:repeaterItem>
70         <netui-data:repeaterFooter>
71             </table>
72   
73         </netui-data:repeaterFooter>
74     </netui-data:repeater>
75     
76     <hr width="90%">
77     <p><netui:anchor action="begin.do">Return to choiceTag Samples Home</netui:anchor></p>             
78     <p>&nbsp;</p>
79     </blockquote>   
80             
81   </body>
82 </html>