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/label/

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>Label Tag Sample</h3>
14     
15         <blockquote>
16         
17         <h4>General Tag Behavior:</h4>
18         
19         <p>This label displays the value of a data binding expression:
20         <b><netui:label value="{request.firstname}"/></b>
21 
22         <p>The label has been passed a string consisting of three ampersands:
23         <b><netui:label value="{request.someString}"/></b>
24 
25         <p>This label has been passed the ampersand character entity string:
26         <b><netui:label value="{request.ampEnt}"/></b>
27 
28         <p>This label has been passed the non-breaking-space entity string:
29         <b><netui:label value="{request.spaceEnt}"/></b>
30 
31         <p>This label displays styled text:
32         <netui:label value="Some Styled Text" style="color:#3333ff;background-color:#ffffcc;font-size:14pt;"/>
33     
34         <h4>Behavior of the <code>defaultValue</code> attribute:</h4>
35         
36         <p>If the default value is a string literal, the &lt;netui:formatString> tag is <i>not</i> applied:
37         <b><netui:label value="{request.somethingNull}" defaultValue="John">
38             <netui:formatString pattern="[####]" />
39         </netui:label></b>
40         
41         <p>If the default value is a data binding expression, the &lt;netui:formatString> tag is applied:
42         <b><netui:label value="{request.somethingNull}" defaultValue="{request.firstname}">
43             <netui:formatString pattern="[####]" />
44         </netui:label></b>  
45                
46         <p>This label displays its default value, 
47         because the data binding expression resolves to the value NULL.  Note that text 
48         escaping is <i>not</i> applied to the default value:
49         <b><netui:label value="{request.somethingNull}" defaultValue="[&nbsp;]"/></b>
50      
51         </blockquote> 
52     
53         <hr>
54         <netui:anchor href="/WebApp/tagSamples/tagSamplesController.jpf">Return to Tag Samples</netui:anchor>   
55 
56     </body>
57 </netui:html>