-->
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
- "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
+ "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
<!-- a tag library descriptor -->
<tag-class>examples.LogTag</tag-class>
<body-content>TAGDEPENDENT</body-content>
<description>
- Perform a server side action; Log the message.
+ Perform a server side action; Log the message.
</description>
<attribute>
- <name>toBrowser</name>
- <required>false</required>
+ <name>toBrowser</name>
+ <required>false</required>
</attribute>
</tag>
-->
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
- "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
+ "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<short-name>simple</short-name>
<uri>http://tomcat.apache.org/example-taglib</uri>
<description>
- A simple tab library for the examples
+ A simple tab library for the examples
</description>
<tag>
<tei-class>examples.FooTagExtraInfo</tei-class>
<body-content>JSP</body-content>
<description>
- Perform a server side action; uses 3 mandatory attributes
+ Perform a server side action; uses 3 mandatory attributes
</description>
<attribute>
<tag-class>examples.LogTag</tag-class>
<body-content>TAGDEPENDENT</body-content>
<description>
- Perform a server side action; Log the message.
+ Perform a server side action; Log the message.
</description>
<attribute>
- <name>toBrowser</name>
- <required>false</required>
+ <name>toBrowser</name>
+ <required>false</required>
</attribute>
</tag>
<short-name>SimpleTagLibrary</short-name>
<uri>http://tomcat.apache.org/jsp2-example-taglib</uri>
<tag>
- <description>Outputs Hello, World</description>
+ <description>Outputs Hello, World</description>
<name>helloWorld</name>
- <tag-class>jsp2.examples.simpletag.HelloWorldSimpleTag</tag-class>
- <body-content>empty</body-content>
+ <tag-class>jsp2.examples.simpletag.HelloWorldSimpleTag</tag-class>
+ <body-content>empty</body-content>
</tag>
<tag>
<description>Repeats the body of the tag 'num' times</description>
</attribute>
</tag>
<tag>
- <description>Populates the page context with a BookBean</description>
+ <description>Populates the page context with a BookBean</description>
<name>findBook</name>
- <tag-class>jsp2.examples.simpletag.FindBookSimpleTag</tag-class>
- <body-content>empty</body-content>
- <attribute>
- <name>var</name>
- <required>true</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
+ <tag-class>jsp2.examples.simpletag.FindBookSimpleTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
</tag>
<tag>
<description>
<attribute>
<name>fragment1</name>
<required>true</required>
- <fragment>true</fragment>
+ <fragment>true</fragment>
</attribute>
<attribute>
<name>fragment2</name>
<required>true</required>
- <fragment>true</fragment>
+ <fragment>true</fragment>
</attribute>
<attribute>
<name>fragment3</name>
<required>true</required>
- <fragment>true</fragment>
+ <fragment>true</fragment>
</attribute>
</tag>
<tag>
</attribute>
</tag>
<tag>
- <description>
- Tag that echoes all its attributes and body content
- </description>
- <name>echoAttributes</name>
- <tag-class>jsp2.examples.simpletag.EchoAttributesTag</tag-class>
- <body-content>empty</body-content>
- <dynamic-attributes>true</dynamic-attributes>
+ <description>
+ Tag that echoes all its attributes and body content
+ </description>
+ <name>echoAttributes</name>
+ <tag-class>jsp2.examples.simpletag.EchoAttributesTag</tag-class>
+ <body-content>empty</body-content>
+ <dynamic-attributes>true</dynamic-attributes>
</tag>
<function>
<description>Reverses the characters in the given String</description>
<name>reverse</name>
- <function-class>jsp2.examples.el.Functions</function-class>
- <function-signature>java.lang.String reverse( java.lang.String )</function-signature>
+ <function-class>jsp2.examples.el.Functions</function-class>
+ <function-signature>java.lang.String reverse( java.lang.String )</function-signature>
</function>
<function>
<description>Counts the number of vowels (a,e,i,o,u) in the given String</description>
<name>countVowels</name>
- <function-class>jsp2.examples.el.Functions</function-class>
- <function-signature>java.lang.String numVowels( java.lang.String )</function-signature>
+ <function-class>jsp2.examples.el.Functions</function-class>
+ <function-signature>java.lang.String numVowels( java.lang.String )</function-signature>
</function>
<function>
- <description>Converts the string to all caps</description>
+ <description>Converts the string to all caps</description>
<name>caps</name>
- <function-class>jsp2.examples.el.Functions</function-class>
- <function-signature>java.lang.String caps( java.lang.String )</function-signature>
+ <function-class>jsp2.examples.el.Functions</function-class>
+ <function-signature>java.lang.String caps( java.lang.String )</function-signature>
</function>
</taglib>
limitations under the License.
-->
<HEAD><TITLE>
- Calendar: A JSP APPLICATION
+ Calendar: A JSP APPLICATION
</TITLE></HEAD>
<jsp:useBean id="table" scope="session" class="cal.TableBean" />
<%
- table.processRequest(request);
- if (table.getProcessError() == false) {
+ table.processRequest(request);
+ if (table.getProcessError() == false) {
%>
<!-- html table goes here -->
</TR>
<FORM METHOD=POST ACTION=cal1.jsp>
<%
- for(int i=0; i<table.getEntries().getRows(); i++) {
- cal.Entry entr = table.getEntries().getEntry(i);
+ for(int i=0; i<table.getEntries().getRows(); i++) {
+ cal.Entry entr = table.getEntries().getEntry(i);
%>
- <TR>
- <TD>
- <A HREF=cal2.jsp?time=<%= entr.getHour() %>>
- <%= entr.getHour() %> </A>
- </TD>
- <TD BGCOLOR=<%= entr.getColor() %>>
- <% out.print(util.HTMLFilter.filter(entr.getDescription())); %>
- </TD>
- </TR>
+ <TR>
+ <TD>
+ <A HREF=cal2.jsp?time=<%= entr.getHour() %>>
+ <%= entr.getHour() %> </A>
+ </TD>
+ <TD BGCOLOR=<%= entr.getColor() %>>
+ <% out.print(util.HTMLFilter.filter(entr.getDescription())); %>
+ </TD>
+ </TR>
<%
- }
+ }
%>
</FORM>
</TABLE>
<TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>
<TR>
<TD ALIGN=CENTER> <% out.print(util.HTMLFilter.filter(table.getName())); %> :
- <% out.print(util.HTMLFilter.filter(table.getEmail())); %> </TD>
+ <% out.print(util.HTMLFilter.filter(table.getEmail())); %> </TD>
</TR>
</TABLE>
</CENTER>
<%
- } else {
+ } else {
%>
<font size=5>
- You must enter your name and email address correctly.
+ You must enter your name and email address correctly.
</font>
<%
- }
+ }
%>
-->
<HEAD><TITLE>
- Calendar: A JSP APPLICATION
+ Calendar: A JSP APPLICATION
</TITLE></HEAD>
<jsp:useBean id="table" scope="session" class="cal.TableBean" />
<%
- String time = request.getParameter ("time");
+ String time = request.getParameter ("time");
%>
<FONT SIZE=5> Please add the following event:
-->
<head>
- <title> Login page for the calendar. </title>
+ <title> Login page for the calendar. </title>
</head>
<body bgcolor="white">
<center>
- <font size=7 color="red"> Please Enter the following information: </font>
+ <font size=7 color="red"> Please Enter the following information: </font>
<br>
- <form method=GET action=cal1.jsp>
+ <form method=GET action=cal1.jsp>
- <font size=5> Name <input type=text name="name" size=20>
- </font>
- <br>
- <font size=5> Email <input type=text name="email" size=20>
- </font>
- <br>
- <input type=submit name=action value="Submit">
+ <font size=5> Name <input type=text name="name" size=20>
+ </font>
+ <br>
+ <font size=5> Email <input type=text name="email" size=20>
+ </font>
+ <br>
+ <input type=submit name=action value="Submit">
- </form>
+ </form>
<hr>
<font size=3 color="red"> Note: This application does not implement the complete
functionality of a typical calendar application. It demostartes a way JSP can be
<hr>
The checked fruits (got using request) are: <br>
<%
- fruits = request.getParameterValues("fruit");
+ fruits = request.getParameterValues("fruit");
%>
<ul>
<%
if (fruits != null) {
- for (int i = 0; i < fruits.length; i++) {
+ for (int i = 0; i < fruits.length; i++) {
%>
<li>
<%
- out.println (util.HTMLFilter.filter(fruits[i]));
- }
- } else out.println ("none selected");
+ out.println (util.HTMLFilter.filter(fruits[i]));
+ }
+ } else out.println ("none selected");
%>
</ul>
<br>
The checked fruits (got using beans) are <br>
<%
- fruits = foo.getFruit();
+ fruits = foo.getFruit();
%>
<ul>
<%
if (!fruits[0].equals("1")) {
- for (int i = 0; i < fruits.length; i++) {
+ for (int i = 0; i < fruits.length; i++) {
%>
<li>
<%
- out.println (util.HTMLFilter.filter(fruits[i]));
- }
- } else out.println ("none selected");
+ out.println (util.HTMLFilter.filter(fruits[i]));
+ }
+ } else out.println ("none selected");
%>
</ul>
</font>
<jsp:setProperty name="cb" property="*" />
<%
- cb.processRequest();
+ cb.processRequest();
%>
<body bgcolor=<%= cb.getColor1() %>>
<p>
<% if (cb.getHint()==true) { %>
-
- <p> Hint #1: Vampires prey at night!
- <p> <p> Hint #2: Nancy without the n.
+
+ <p> Hint #1: Vampires prey at night!
+ <p> <p> Hint #2: Nancy without the n.
<% } %>
<% if (cb.getSuccess()==true) { %>
<p> CONGRATULATIONS!!
- <% if (cb.getHintTaken()==true) { %>
+ <% if (cb.getHintTaken()==true) { %>
<p> ( although I know you cheated and peeked into the hints)
- <% } %>
+ <% } %>
<% } %>
<font size=4>
<ul>
-<li> Day of month: is <jsp:getProperty name="clock" property="dayOfMonth"/>
-<li> Year: is <jsp:getProperty name="clock" property="year"/>
-<li> Month: is <jsp:getProperty name="clock" property="month"/>
-<li> Time: is <jsp:getProperty name="clock" property="time"/>
-<li> Date: is <jsp:getProperty name="clock" property="date"/>
-<li> Day: is <jsp:getProperty name="clock" property="day"/>
-<li> Day Of Year: is <jsp:getProperty name="clock" property="dayOfYear"/>
-<li> Week Of Year: is <jsp:getProperty name="clock" property="weekOfYear"/>
-<li> era: is <jsp:getProperty name="clock" property="era"/>
-<li> DST Offset: is <jsp:getProperty name="clock" property="DSTOffset"/>
-<li> Zone Offset: is <jsp:getProperty name="clock" property="zoneOffset"/>
+<li> Day of month: is <jsp:getProperty name="clock" property="dayOfMonth"/>
+<li> Year: is <jsp:getProperty name="clock" property="year"/>
+<li> Month: is <jsp:getProperty name="clock" property="month"/>
+<li> Time: is <jsp:getProperty name="clock" property="time"/>
+<li> Date: is <jsp:getProperty name="clock" property="date"/>
+<li> Day: is <jsp:getProperty name="clock" property="day"/>
+<li> Day Of Year: is <jsp:getProperty name="clock" property="dayOfYear"/>
+<li> Week Of Year: is <jsp:getProperty name="clock" property="weekOfYear"/>
+<li> era: is <jsp:getProperty name="clock" property="era"/>
+<li> DST Offset: is <jsp:getProperty name="clock" property="DSTOffset"/>
+<li> Zone Offset: is <jsp:getProperty name="clock" property="zoneOffset"/>
</ul>
</font>
-->
<body bgcolor="lightblue">
- <%@ page errorPage="errorpge.jsp" %>
- <jsp:useBean id="foo" scope="request" class="error.Smart" />
- <%
- String name = null;
+ <%@ page errorPage="errorpge.jsp" %>
+ <jsp:useBean id="foo" scope="request" class="error.Smart" />
+ <%
+ String name = null;
- if (request.getParameter("name") == null) {
- %>
- <%@ include file="error.html" %>
- <%
- } else {
- foo.setName(request.getParameter("name"));
- if (foo.getName().equalsIgnoreCase("integra"))
- name = "acura";
- if (name.equalsIgnoreCase("acura")) {
- %>
+ if (request.getParameter("name") == null) {
+ %>
+ <%@ include file="error.html" %>
+ <%
+ } else {
+ foo.setName(request.getParameter("name"));
+ if (foo.getName().equalsIgnoreCase("integra"))
+ name = "acura";
+ if (name.equalsIgnoreCase("acura")) {
+ %>
- <H1> Yes!!! <a href="http://www.acura.com">Acura</a> is my favorite car.
+ <H1> Yes!!! <a href="http://www.acura.com">Acura</a> is my favorite car.
- <%
- }
- }
- %>
+ <%
+ }
+ }
+ %>
</body>
</html>
<body bgcolor="red">
- <%@ page isErrorPage="true" %>
- <h1> The exception <%= exception.getMessage() %> tells me you
- made a wrong choice.
+ <%@ page isErrorPage="true" %>
+ <h1> The exception <%= exception.getMessage() %> tells me you
+ made a wrong choice.
</body>
</html>
<code>
<table border="1">
<thead>
- <td><b>EL Expression</b></td>
- <td><b>Result</b></td>
- </thead>
- <tr>
- <td>\${1}</td>
- <td>${1}</td>
- </tr>
- <tr>
- <td>\${1 + 2}</td>
- <td>${1 + 2}</td>
- </tr>
- <tr>
- <td>\${1.2 + 2.3}</td>
- <td>${1.2 + 2.3}</td>
- </tr>
- <tr>
- <td>\${1.2E4 + 1.4}</td>
- <td>${1.2E4 + 1.4}</td>
- </tr>
- <tr>
- <td>\${-4 - 2}</td>
- <td>${-4 - 2}</td>
- </tr>
- <tr>
- <td>\${21 * 2}</td>
- <td>${21 * 2}</td>
- </tr>
- <tr>
- <td>\${3/4}</td>
- <td>${3/4}</td>
- </tr>
- <tr>
- <td>\${3 div 4}</td>
- <td>${3 div 4}</td>
- </tr>
- <tr>
- <td>\${3/0}</td>
- <td>${3/0}</td>
- </tr>
- <tr>
- <td>\${10%4}</td>
- <td>${10%4}</td>
- </tr>
- <tr>
- <td>\${10 mod 4}</td>
- <td>${10 mod 4}</td>
- </tr>
+ <td><b>EL Expression</b></td>
+ <td><b>Result</b></td>
+ </thead>
+ <tr>
+ <td>\${1}</td>
+ <td>${1}</td>
+ </tr>
+ <tr>
+ <td>\${1 + 2}</td>
+ <td>${1 + 2}</td>
+ </tr>
+ <tr>
+ <td>\${1.2 + 2.3}</td>
+ <td>${1.2 + 2.3}</td>
+ </tr>
+ <tr>
+ <td>\${1.2E4 + 1.4}</td>
+ <td>${1.2E4 + 1.4}</td>
+ </tr>
+ <tr>
+ <td>\${-4 - 2}</td>
+ <td>${-4 - 2}</td>
+ </tr>
+ <tr>
+ <td>\${21 * 2}</td>
+ <td>${21 * 2}</td>
+ </tr>
+ <tr>
+ <td>\${3/4}</td>
+ <td>${3/4}</td>
+ </tr>
+ <tr>
+ <td>\${3 div 4}</td>
+ <td>${3 div 4}</td>
+ </tr>
+ <tr>
+ <td>\${3/0}</td>
+ <td>${3/0}</td>
+ </tr>
+ <tr>
+ <td>\${10%4}</td>
+ <td>${10%4}</td>
+ </tr>
+ <tr>
+ <td>\${10 mod 4}</td>
+ <td>${10 mod 4}</td>
+ </tr>
<tr>
<td>\${(1==2) ? 3 : 4}</td>
<td>${(1==2) ? 3 : 4}</td>
</tr>
- </table>
+ </table>
</code>
</blockquote>
</body>
<code>
<table border="1">
<thead>
- <td><b>EL Expression</b></td>
- <td><b>Result</b></td>
- </thead>
- <tr>
- <td>\${1 < 2}</td>
- <td>${1 < 2}</td>
- </tr>
- <tr>
- <td>\${1 lt 2}</td>
- <td>${1 lt 2}</td>
- </tr>
- <tr>
- <td>\${1 > (4/2)}</td>
- <td>${1 > (4/2)}</td>
- </tr>
- <tr>
- <td>\${1 gt (4/2)}</td>
- <td>${1 gt (4/2)}</td>
- </tr>
- <tr>
- <td>\${4.0 >= 3}</td>
- <td>${4.0 >= 3}</td>
- </tr>
- <tr>
- <td>\${4.0 ge 3}</td>
- <td>${4.0 ge 3}</td>
- </tr>
- <tr>
- <td>\${4 <= 3}</td>
- <td>${4 <= 3}</td>
- </tr>
- <tr>
- <td>\${4 le 3}</td>
- <td>${4 le 3}</td>
- </tr>
- <tr>
- <td>\${100.0 == 100}</td>
- <td>${100.0 == 100}</td>
- </tr>
- <tr>
- <td>\${100.0 eq 100}</td>
- <td>${100.0 eq 100}</td>
- </tr>
- <tr>
- <td>\${(10*10) != 100}</td>
- <td>${(10*10) != 100}</td>
- </tr>
- <tr>
- <td>\${(10*10) ne 100}</td>
- <td>${(10*10) ne 100}</td>
- </tr>
- </table>
+ <td><b>EL Expression</b></td>
+ <td><b>Result</b></td>
+ </thead>
+ <tr>
+ <td>\${1 < 2}</td>
+ <td>${1 < 2}</td>
+ </tr>
+ <tr>
+ <td>\${1 lt 2}</td>
+ <td>${1 lt 2}</td>
+ </tr>
+ <tr>
+ <td>\${1 > (4/2)}</td>
+ <td>${1 > (4/2)}</td>
+ </tr>
+ <tr>
+ <td>\${1 gt (4/2)}</td>
+ <td>${1 gt (4/2)}</td>
+ </tr>
+ <tr>
+ <td>\${4.0 >= 3}</td>
+ <td>${4.0 >= 3}</td>
+ </tr>
+ <tr>
+ <td>\${4.0 ge 3}</td>
+ <td>${4.0 ge 3}</td>
+ </tr>
+ <tr>
+ <td>\${4 <= 3}</td>
+ <td>${4 <= 3}</td>
+ </tr>
+ <tr>
+ <td>\${4 le 3}</td>
+ <td>${4 le 3}</td>
+ </tr>
+ <tr>
+ <td>\${100.0 == 100}</td>
+ <td>${100.0 == 100}</td>
+ </tr>
+ <tr>
+ <td>\${100.0 eq 100}</td>
+ <td>${100.0 eq 100}</td>
+ </tr>
+ <tr>
+ <td>\${(10*10) != 100}</td>
+ <td>${(10*10) != 100}</td>
+ </tr>
+ <tr>
+ <td>\${(10*10) ne 100}</td>
+ <td>${(10*10) ne 100}</td>
+ </tr>
+ </table>
</code>
<br>
<u><b>Alphabetic</b></u>
<code>
<table border="1">
<thead>
- <td><b>EL Expression</b></td>
- <td><b>Result</b></td>
- </thead>
- <tr>
- <td>\${'a' < 'b'}</td>
- <td>${'a' < 'b'}</td>
- </tr>
- <tr>
- <td>\${'hip' > 'hit'}</td>
- <td>${'hip' > 'hit'}</td>
- </tr>
- <tr>
- <td>\${'4' > 3}</td>
- <td>${'4' > 3}</td>
- </tr>
- </table>
+ <td><b>EL Expression</b></td>
+ <td><b>Result</b></td>
+ </thead>
+ <tr>
+ <td>\${'a' < 'b'}</td>
+ <td>${'a' < 'b'}</td>
+ </tr>
+ <tr>
+ <td>\${'hip' > 'hit'}</td>
+ <td>${'hip' > 'hit'}</td>
+ </tr>
+ <tr>
+ <td>\${'4' > 3}</td>
+ <td>${'4' > 3}</td>
+ </tr>
+ </table>
</code>
</blockquote>
</body>
<blockquote>
<u><b>Change Parameter</b></u>
<form action="functions.jsp" method="GET">
- foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
+ foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
<input type="submit">
</form>
<br>
<code>
<table border="1">
<thead>
- <td><b>EL Expression</b></td>
- <td><b>Result</b></td>
- </thead>
- <tr>
- <td>\${param["foo"]}</td>
- <td>${fn:escapeXml(param["foo"])} </td>
- </tr>
- <tr>
- <td>\${my:reverse(param["foo"])}</td>
- <td>${my:reverse(fn:escapeXml(param["foo"]))} </td>
- </tr>
- <tr>
- <td>\${my:reverse(my:reverse(param["foo"]))}</td>
- <td>${my:reverse(my:reverse(fn:escapeXml(param["foo"])))} </td>
- </tr>
- <tr>
- <td>\${my:countVowels(param["foo"])}</td>
- <td>${my:countVowels(fn:escapeXml(param["foo"]))} </td>
- </tr>
- </table>
+ <td><b>EL Expression</b></td>
+ <td><b>Result</b></td>
+ </thead>
+ <tr>
+ <td>\${param["foo"]}</td>
+ <td>${fn:escapeXml(param["foo"])} </td>
+ </tr>
+ <tr>
+ <td>\${my:reverse(param["foo"])}</td>
+ <td>${my:reverse(fn:escapeXml(param["foo"]))} </td>
+ </tr>
+ <tr>
+ <td>\${my:reverse(my:reverse(param["foo"]))}</td>
+ <td>${my:reverse(my:reverse(fn:escapeXml(param["foo"])))} </td>
+ </tr>
+ <tr>
+ <td>\${my:countVowels(param["foo"])}</td>
+ <td>${my:countVowels(fn:escapeXml(param["foo"]))} </td>
+ </tr>
+ </table>
</code>
</blockquote>
</body>
<blockquote>
<u><b>Change Parameter</b></u>
<form action="implicit-objects.jsp" method="GET">
- foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
+ foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
<input type="submit">
</form>
<br>
<code>
<table border="1">
<thead>
- <td><b>EL Expression</b></td>
- <td><b>Result</b></td>
- </thead>
- <tr>
- <td>\${param.foo}</td>
- <td>${fn:escapeXml(param["foo"])} </td>
- </tr>
- <tr>
- <td>\${param["foo"]}</td>
- <td>${fn:escapeXml(param["foo"])} </td>
- </tr>
- <tr>
- <td>\${header["host"]}</td>
- <td>${fn:escapeXml(header["host"])} </td>
- </tr>
- <tr>
- <td>\${header["accept"]}</td>
- <td>${fn:escapeXml(header["accept"])} </td>
- </tr>
- <tr>
- <td>\${header["user-agent"]}</td>
- <td>${fn:escapeXml(header["user-agent"])} </td>
- </tr>
- </table>
+ <td><b>EL Expression</b></td>
+ <td><b>Result</b></td>
+ </thead>
+ <tr>
+ <td>\${param.foo}</td>
+ <td>${fn:escapeXml(param["foo"])} </td>
+ </tr>
+ <tr>
+ <td>\${param["foo"]}</td>
+ <td>${fn:escapeXml(param["foo"])} </td>
+ </tr>
+ <tr>
+ <td>\${header["host"]}</td>
+ <td>${fn:escapeXml(header["host"])} </td>
+ </tr>
+ <tr>
+ <td>\${header["accept"]}</td>
+ <td>${fn:escapeXml(header["accept"])} </td>
+ </tr>
+ <tr>
+ <td>\${header["user-agent"]}</td>
+ <td>${fn:escapeXml(header["user-agent"])} </td>
+ </tr>
+ </table>
</code>
</blockquote>
</body>
Bean created! Setting foo.bar...<br>
<jsp:setProperty name="foo" property="bar">
<jsp:attribute name="value">
- <my:helloWorld/>
+ <my:helloWorld/>
</jsp:attribute>
</jsp:setProperty>
</jsp:useBean>
<tags:xhtmlbasic xmlns:tags="urn:jsptagdir:/WEB-INF/tags"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
- xmlns="http://www.w3.org/1999/xhtml">
+ xmlns="http://www.w3.org/1999/xhtml">
<jsp:directive.page contentType="text/html" />
<head>
<title>JSPX - XHTML Basic Example</title>
<li>Uses <include-prelude> to include the top banner.</li>
<li>Uses <include-coda> to include the bottom banner.</li>
<li>Uses <scripting-invalid> true to disable
- <% scripting %> elements</li>
+ <% scripting %> elements</li>
<li>Uses <el-ignored> true to disable ${EL} elements</li>
<li>Uses <page-encoding> ISO-8859-1 to set the page encoding (though this is the default anyway)</li>
</ul>
<h2>Invocation 3 (three attributes)</h2>
<ul>
<my:echoAttributes dogName="Scruffy"
- catName="Fluffy"
- blowfishName="Puffy"/>
+ catName="Fluffy"
+ blowfishName="Puffy"/>
</ul>
</body>
</html>
<my:findBook var="book"/>
<table border="1">
<thead>
- <td><b>Field</b></td>
- <td><b>Value</b></td>
- <td><b>Capitalized</b></td>
- </thead>
- <tr>
- <td>Title</td>
- <td>${book.title}</td>
- <td>${my:caps(book.title)}</td>
- </tr>
- <tr>
- <td>Author</td>
- <td>${book.author}</td>
- <td>${my:caps(book.author)}</td>
- </tr>
- <tr>
- <td>ISBN</td>
- <td>${book.isbn}</td>
- <td>${my:caps(book.isbn)}</td>
- </tr>
+ <td><b>Field</b></td>
+ <td><b>Value</b></td>
+ <td><b>Capitalized</b></td>
+ </thead>
+ <tr>
+ <td>Title</td>
+ <td>${book.title}</td>
+ <td>${my:caps(book.title)}</td>
+ </tr>
+ <tr>
+ <td>Author</td>
+ <td>${book.author}</td>
+ <td>${my:caps(book.author)}</td>
+ </tr>
+ <tr>
+ <td>ISBN</td>
+ <td>${book.isbn}</td>
+ <td>${my:caps(book.isbn)}</td>
+ </tr>
</table>
</body>
</html>
<tr valign="top">
<td>
<tags:panel color="#ff8080" bgcolor="#ffc0c0" title="Panel 1">
- First panel.<br/>
- </tags:panel>
+ First panel.<br/>
+ </tags:panel>
</td>
<td>
<tags:panel color="#80ff80" bgcolor="#c0ffc0" title="Panel 2">
- Second panel.<br/>
- Second panel.<br/>
- Second panel.<br/>
- Second panel.<br/>
- </tags:panel>
+ Second panel.<br/>
+ Second panel.<br/>
+ Second panel.<br/>
+ Second panel.<br/>
+ </tags:panel>
</td>
<td>
<tags:panel color="#8080ff" bgcolor="#c0c0ff" title="Panel 3">
- Third panel.<br/>
+ Third panel.<br/>
<tags:panel color="#ff80ff" bgcolor="#ffc0ff" title="Inner">
- A panel in a panel.
- </tags:panel>
- Third panel.<br/>
- </tags:panel>
+ A panel in a panel.
+ </tags:panel>
+ Third panel.<br/>
+ </tags:panel>
</td>
</tr>
</table>
<h2>Products</h2>
<tags:displayProducts>
<jsp:attribute name="normalPrice">
- Item: ${name}<br/>
- Price: ${price}
+ Item: ${name}<br/>
+ Price: ${price}
</jsp:attribute>
<jsp:attribute name="onSale">
- Item: ${name}<br/>
- <font color="red"><strike>Was: ${origPrice}</strike></font><br/>
- <b>Now: ${salePrice}</b>
+ Item: ${name}<br/>
+ <font color="red"><strike>Was: ${origPrice}</strike></font><br/>
+ <b>Now: ${salePrice}</b>
</jsp:attribute>
</tags:displayProducts>
<hr>
<h2>Products (Same tag, alternate style)</h2>
<tags:displayProducts>
<jsp:attribute name="normalPrice">
- <b>${name}</b> @ ${price} ea.
+ <b>${name}</b> @ ${price} ea.
</jsp:attribute>
<jsp:attribute name="onSale">
- <b>${name}</b> @ ${salePrice} ea. (was: ${origPrice})
+ <b>${name}</b> @ ${salePrice} ea. (was: ${origPrice})
</jsp:attribute>
</tags:displayProducts>
</body>
<jsp:setProperty name="cart" property="*" />
<%
- cart.processRequest();
+ cart.processRequest();
%>
<br> You have the following items in your cart:
<ol>
<%
- String[] items = cart.getItems();
- for (int i=0; i<items.length; i++) {
+ String[] items = cart.getItems();
+ for (int i=0; i<items.length; i++) {
%>
<li> <% out.print(util.HTMLFilter.filter(items[i])); %>
<%
- }
+ }
%>
</ol>
<c:forEach var="index" begin="0" end="4">
# ${index}:
<c:choose>
- <c:when test="${index == 1}">
+ <c:when test="${index == 1}">
One!</br>
- </c:when>
- <c:when test="${index == 4}">
+ </c:when>
+ <c:when test="${index == 4}">
Four!</br>
- </c:when>
- <c:when test="${index == 3}">
+ </c:when>
+ <c:when test="${index == 3}">
Three!</br>
- </c:when>
- <c:otherwise>
+ </c:when>
+ <c:otherwise>
Huh?</br>
- </c:otherwise>
+ </c:otherwise>
</c:choose>
</c:forEach>
</body>
</c:forEach>
<% Vector v = new Vector();
- v.add("One"); v.add("Two"); v.add("Three"); v.add("Four");
+ v.add("One"); v.add("Two"); v.add("Three"); v.add("Four");
- pageContext.setAttribute("vector", v);
+ pageContext.setAttribute("vector", v);
%>
<h3>Iterating over a Vector</h3>
<c:forEach items="${vector}" var="item" >
- ${item}
+ ${item}
</c:forEach>
</body>
</html>
<h3>Conditionally execute the body</h3>
<c:if test="${2>0}">
- It's true that (2>0)!
+ It's true that (2>0)!
</c:if>
</body>
</html>