Index.jsp Sample

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

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 <%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%>
05 <netui:html>
06     <head>
07         <title>
08             index.jsp
09         </title>
10     </head>
11     <body>
12     <jsp:include page="/resources/jsp/header.jsp"/>
13     <h3>Select Tag Sample</h3>
14     <p>The following selection field allows to select only one item.
15     <netui:form action="submit">
16         <netui:select dataSource="{actionForm.selections}" size="1">
17             <netui:selectOption value="red" />
18             <netui:selectOption value="blue" />
19             <netui:selectOption value="green" />
20             <netui:selectOption value="yellow" />
21             <netui:selectOption value="orange" />
22         </netui:select>
23         <netui:button type="submit" value="Submit" />
24     </netui:form>
25     
26     <hr>
27     
28     <p>The following selection field allows selection of multiple items.
29     <p><b>Hold down the Ctrl key to select multiple options.</b>
30     <netui:form action="submit">
31         <netui:select multiple="true" dataSource="{actionForm.selections}" size="5">
32             <netui:selectOption value="red" />
33             <netui:selectOption value="blue" />
34             <netui:selectOption value="green" />
35             <netui:selectOption value="yellow" />
36             <netui:selectOption value="orange" />
37         </netui:select>
38         <netui:button type="submit" value="Submit"/>
39     </netui:form>
40     
41     <hr>
42         
43     <p>The following selection field allows selection of multiple items.  Note that
44     multiple options have been pre-selected.
45     <p><b>Hold down the Ctrl key to select multiple options.</b>
46     <netui:form action="submit">
47         <netui:select multiple="true" dataSource="{actionForm.selections}" defaultValue="{pageInput._preSelectedOptions}" size="5">
48             <netui:selectOption value="red" />
49             <netui:selectOption value="blue" />
50             <netui:selectOption value="green" />
51             <netui:selectOption value="yellow" />
52             <netui:selectOption value="orange" />
53         </netui:select>
54         <netui:button type="submit" value="Submit"/>
55     </netui:form>
56     
57     <hr>
58     
59     <p>The following selection field was generated dynamically by pointing the 
60     optionsDataSource attribute at a String[] object.
61     <netui:form action="submit">
62         <netui:select optionsDataSource="{pageFlow._options}" dataSource="{actionForm.selections}" size="1"/>
63         <netui:button type="submit" value="Submit"/>
64     </netui:form>
65 
66     <hr>
67     
68     <p>The following selection field was generated dynamically by pointing the 
69     optionsDataSource attribute at a HashMap object.  This generates a set of options
70     that have display text that is different from their submitted text.
71     <netui:form action="submit">
72         <netui:select optionsDataSource="{pageFlow._hashMap}" dataSource="{actionForm.selections}" size="1"/>
73         <netui:button type="submit" value="Submit"/>
74     </netui:form>
75 
76         <hr>
77         <netui:anchor href="/WebApp/tagSamples/tagSamplesController.jpf">Return to Tag Samples</netui:anchor>
78 </netui:html>