List_users.jsp Sample

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

Sample Location

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

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/controls/database/

Sample Source Code


01 <%@ page language="java" contentType="text/html;charset=UTF-8"%>
02 
03 <%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%>
04 <%@ taglib uri="netui-tags-html.tld" prefix="netui"%>
05 
06 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
07 
08 <html>
09     <head>
10         <netui:base/>
11         <title>Java Control: Called from a Page Flow</title>
12         <link href="/WebApp/resources/css/style.css" type="text/css" rel="stylesheet"/>
13     </head>
14   
15     <body>
16         <jsp:include page="/resources/jsp/header.jsp"/>
17         <h3>Calling a Database Control</h3>
18         <p>This JSP page is part of a Page Flow that calls a Java control.
19         Instead of embedding the business logic in this JSP, the Page 
20         Flow's Controller file is used to call the separate Java control, UsersDBControl.jcx.</p>
21         <hr>
22         <blockquote>
23     
24         <netui:label 
25         value="Add or Remove User Accounts" style="font-size : 12px; font-family : Verdana, Arial;
26         font-weight : bold; color: black; text-align: left;
27         padding-left: 5px;" />
28           
29         <!--This netui-data:repeater element calls the getAllUsers method
30         on the page flow callJavaControlController.jpf via the XScript 
31         expression {pageFlow.allUsers}.  "pageFlow" refers to 
32         callJavaControlController.jpf; "allUsers" refers to the getter 
33         method getAllUsers in callJavaControlController.jpf -->
34         <netui-data:repeater dataSource="{pageFlow.allUsers}">
35             <netui-data:repeaterHeader>
36                 <table border=1>
37                 <tr><td class="header-text">Username</td>
38                 <td class="header-text">Password</td></tr>
39             </netui-data:repeaterHeader>
40             <netui-data:repeaterItem>
41                 <tr>
42                  <td class="row-text"><netui:label value="{container.item.username}"/></td>
43                  <td class="row-text"><netui:label value="{container.item.password}"/></td>
44                  <td class="row-text">
45                   <netui:anchor action="deleteUser">
46                     <netui:parameter name="userToDelete" value="{container.item.username}"/>Delete
47                   </netui:anchor>
48                  </td> 
49                 </tr>
50             </netui-data:repeaterItem>
51             <netui-data:repeaterFooter>
52                 </table>
53             </netui-data:repeaterFooter>
54         </netui-data:repeater>
55     
56         <p>
57         <netui:form action="addUser">
58             <font color="red"><netui:label value="{actionForm.message}" /></font>
59             <br>
60             <table>
61                 <tr><td class="label">Username:</td><td><netui:textBox dataSource="username" /></td></tr>
62                 <tr><td class="label">Password:</td><td><netui:textBox dataSource="password" /></td></tr>
63             </table>
64             <br>
65             <netui:button type="Submit">Add New Account</netui:button>
66         </netui:form>
67     
68         </blockquote>
69     
70         <hr>
71         <p><netui:anchor href="/WebApp/controls/controlsController.jpf">Back to Control Samples</netui:anchor>
72            
73     </body>
74 </html>