Sum.jsp Sample

This topic inludes the source code for the Sum.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/callPageFlow/

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     <netui:base/>
09     <title>Demonstrate callPageFlow Tags</title>
10     <link href="../../../resources/css/style.css" type="text/css" rel="stylesheet"/>
11   </head>
12   
13   <body style="margin:0">
14   
15   <jsp:include page="/resources/jsp/header.jsp"/>
16   
17   <blockquote>
18   
19     <b>Sum Items in Cart</b><br/>
20     <netui-data:repeater dataSource="{pageFlow.cart.lineItemList}">
21         <netui-data:repeaterHeader>
22             <table class="table">
23             <tr class="tablehead">
24                 <td>
25                     Name
26                 </td>
27                 <td>
28                     Quantity
29                 </td>
30                 <td>
31                     Item Price
32                 </td>
33                 <td>
34                     Total Price
35                 </td>
36             </tr>
37         </netui-data:repeaterHeader>
38         <netui-data:repeaterItem>
39             <tr class="row">
40                 <td>
41                     <netui:label value="{container.item.name}"/>
42                 </td>
43                 <td>
44                     <center><netui:label value="{container.item.quantity}"/></center>
45                 </td>
46                 <td>
47                     <netui:label value="{container.item.price}">
48                         <netui:formatNumber pattern="$#,###,###.00"/>
49                     </netui:label>
50                 </td>
51                 <td>
52                     <netui:label value="{container.item.total}">
53                         <netui:formatNumber pattern="$#,###,###.00"/>
54                     </netui:label>
55                 </td>
56             </tr>
57         </netui-data:repeaterItem>
58         <netui-data:repeaterFooter>
59             <tr>
60                 <td></td>
61                 <td></td>
62                 <td bgcolor="#ffcccc">Sum:</td>
63                 <td bgcolor="#ffcccc">
64                     <%--
65                     The following netui-data:callPageFlow tag calls the sumCartItems method
66                     on the page flow callPageFlowController.jpf.
67                     The result, stored in the property "cartSum", is displayed by the netui:label 
68                     tag below. This property is accessible by the data binding expression
69           {pageContext.cartSum}.
70                     --%>
71                     <netui-data:callPageFlow method="sumCartItems" resultId="cartSum">
72                         <netui-data:methodParameter value="{pageFlow.cart.lineItemList}"/>
73                     </netui-data:callPageFlow>
74                     <netui:label value="{pageContext.cartSum}">
75                         <netui:formatNumber pattern="$#,###,###.00"/>
76                     </netui:label>
77                 </td>
78              </tr>
79             </table>
80         </netui-data:repeaterFooter>
81     </netui-data:repeater>
82     
83     
84     <hr size=align=left width=75%>
85 
86    <p><b>Implementation note:</b> the source files for this feature
87             sample are in:</p>
88 
89     <p>&lt;WEBLOGIC_HOME&gt;\samples\workshop\SamplesApp\WebApp\callPageFlow</p>
90 
91     <p>&nbsp;</p>   
92     
93     <p><netui:anchor action="begin">Return to Call Page Flow Sample Home</netui:anchor></p>    
94     
95     </blockquote>
96     
97 </body>
98 
99 </html>