Grosse MàJ
This commit is contained in:
@ -0,0 +1,45 @@
|
||||
<html><body><pre>
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package jsp2.examples.el;
|
||||
|
||||
/**
|
||||
* Defines the functions for the jsp2 example tag library.
|
||||
*
|
||||
* <p>Each function is defined as a static method.</p>
|
||||
*/
|
||||
public class Functions {
|
||||
public static String reverse( String text ) {
|
||||
return new StringBuffer( text ).reverse().toString();
|
||||
}
|
||||
|
||||
public static int numVowels( String text ) {
|
||||
String vowels = "aeiouAEIOU";
|
||||
int result = 0;
|
||||
for( int i = 0; i < text.length(); i++ ) {
|
||||
if( vowels.indexOf( text.charAt( i ) ) != -1 ) {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String caps( String text ) {
|
||||
return text.toUpperCase();
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="basic-arithmetic.jsp"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="basic-arithmetic.jsp.html">Source Code for Basic Arithmetic Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,88 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Basic Arithmetic</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Basic Arithmetic</h1>
|
||||
<hr>
|
||||
This example illustrates basic Expression Language arithmetic.
|
||||
Addition (+), subtraction (-), multiplication (*), division (/ or div),
|
||||
and modulus (% or mod) are all supported. Error conditions, like
|
||||
division by zero, are handled gracefully.
|
||||
<br>
|
||||
<blockquote>
|
||||
<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>
|
||||
<tr>
|
||||
<td>\${(1==2) ? 3 : 4}</td>
|
||||
<td>${(1==2) ? 3 : 4}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,90 @@
|
||||
<html><body><pre>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Basic Arithmetic</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Basic Arithmetic</h1>
|
||||
<hr>
|
||||
This example illustrates basic Expression Language arithmetic.
|
||||
Addition (+), subtraction (-), multiplication (*), division (/ or div),
|
||||
and modulus (% or mod) are all supported. Error conditions, like
|
||||
division by zero, are handled gracefully.
|
||||
<br>
|
||||
<blockquote>
|
||||
<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>
|
||||
<tr>
|
||||
<td>\${(1==2) ? 3 : 4}</td>
|
||||
<td>${(1==2) ? 3 : 4}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="basic-comparisons.jsp"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="basic-comparisons.jsp.html">Source Code for Basic Comparisons Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,116 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Basic Comparisons</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Basic Comparisons</h1>
|
||||
<hr>
|
||||
This example illustrates basic Expression Language comparisons.
|
||||
The following comparison operators are supported:
|
||||
<ul>
|
||||
<li>Less-than (< or lt)</li>
|
||||
<li>Greater-than (> or gt)</li>
|
||||
<li>Less-than-or-equal (<= or le)</li>
|
||||
<li>Greater-than-or-equal (>= or ge)</li>
|
||||
<li>Equal (== or eq)</li>
|
||||
<li>Not Equal (!= or ne)</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<u><b>Numeric</b></u>
|
||||
<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 > (4/2)}</td>
|
||||
<td>${1 > (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>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,118 @@
|
||||
<html><body><pre>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Basic Comparisons</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Basic Comparisons</h1>
|
||||
<hr>
|
||||
This example illustrates basic Expression Language comparisons.
|
||||
The following comparison operators are supported:
|
||||
<ul>
|
||||
<li>Less-than (&lt; or lt)</li>
|
||||
<li>Greater-than (&gt; or gt)</li>
|
||||
<li>Less-than-or-equal (&lt;= or le)</li>
|
||||
<li>Greater-than-or-equal (&gt;= or ge)</li>
|
||||
<li>Equal (== or eq)</li>
|
||||
<li>Not Equal (!= or ne)</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<u><b>Numeric</b></u>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${1 &lt; 2}</td>
|
||||
<td>${1 < 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 lt 2}</td>
|
||||
<td>${1 lt 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 &gt; (4/2)}</td>
|
||||
<td>${1 > (4/2)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 &gt; (4/2)}</td>
|
||||
<td>${1 > (4/2)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${4.0 &gt;= 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 &lt;= 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' &lt; 'b'}</td>
|
||||
<td>${'a' < 'b'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${'hip' &gt; 'hit'}</td>
|
||||
<td>${'hip' > 'hit'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${'4' &gt; 3}</td>
|
||||
<td>${'4' > 3}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
@ -0,0 +1,32 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="functions.jsp?foo=JSP+2.0"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="functions.jsp.html">Source Code for functions.jsp<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="Functions.java.html">Source Code for Functions.java<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,66 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="my" uri="http://jakarta.apache.org/tomcat/jsp2-example-taglib"%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Functions</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Functions</h1>
|
||||
<hr>
|
||||
An upgrade from the JSTL expression language, the JSP 2.0 EL also
|
||||
allows for simple function invocation. Functions are defined
|
||||
by tag libraries and are implemented by a Java programmer as
|
||||
static methods.
|
||||
|
||||
<blockquote>
|
||||
<u><b>Change Parameter</b></u>
|
||||
<form action="functions.jsp" method="GET">
|
||||
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>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,68 @@
|
||||
<html><body><pre>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="my" uri="http://jakarta.apache.org/tomcat/jsp2-example-taglib"%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Functions</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Functions</h1>
|
||||
<hr>
|
||||
An upgrade from the JSTL expression language, the JSP 2.0 EL also
|
||||
allows for simple function invocation. Functions are defined
|
||||
by tag libraries and are implemented by a Java programmer as
|
||||
static methods.
|
||||
|
||||
<blockquote>
|
||||
<u><b>Change Parameter</b></u>
|
||||
<form action="functions.jsp" method="GET">
|
||||
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"])}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${my:reverse(param["foo"])}</td>
|
||||
<td>${my:reverse(fn:escapeXml(param["foo"]))}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${my:reverse(my:reverse(param["foo"]))}</td>
|
||||
<td>${my:reverse(my:reverse(fn:escapeXml(param["foo"])))}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${my:countVowels(param["foo"])}</td>
|
||||
<td>${my:countVowels(fn:escapeXml(param["foo"]))}&nbsp;</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</pre></body></html>
|
@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="implicit-objects.jsp?foo=bar"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html">
|
||||
<img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="implicit-objects.jsp.html">Source Code for Implicit Objects Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,89 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Implicit Objects</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Implicit Objects</h1>
|
||||
<hr>
|
||||
This example illustrates some of the implicit objects available
|
||||
in the Expression Lanaguage. The following implicit objects are
|
||||
available (not all illustrated here):
|
||||
<ul>
|
||||
<li>pageContext - the PageContext object</li>
|
||||
<li>pageScope - a Map that maps page-scoped attribute names to
|
||||
their values</li>
|
||||
<li>requestScope - a Map that maps request-scoped attribute names
|
||||
to their values</li>
|
||||
<li>sessionScope - a Map that maps session-scoped attribute names
|
||||
to their values</li>
|
||||
<li>applicationScope - a Map that maps application-scoped attribute
|
||||
names to their values</li>
|
||||
<li>param - a Map that maps parameter names to a single String
|
||||
parameter value</li>
|
||||
<li>paramValues - a Map that maps parameter names to a String[] of
|
||||
all values for that parameter</li>
|
||||
<li>header - a Map that maps header names to a single String
|
||||
header value</li>
|
||||
<li>headerValues - a Map that maps header names to a String[] of
|
||||
all values for that header</li>
|
||||
<li>initParam - a Map that maps context initialization parameter
|
||||
names to their String parameter value</li>
|
||||
<li>cookie - a Map that maps cookie names to a single Cookie object.</li>
|
||||
</ul>
|
||||
|
||||
<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"])}">
|
||||
<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>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,91 @@
|
||||
<html><body><pre>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Implicit Objects</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Implicit Objects</h1>
|
||||
<hr>
|
||||
This example illustrates some of the implicit objects available
|
||||
in the Expression Lanaguage. The following implicit objects are
|
||||
available (not all illustrated here):
|
||||
<ul>
|
||||
<li>pageContext - the PageContext object</li>
|
||||
<li>pageScope - a Map that maps page-scoped attribute names to
|
||||
their values</li>
|
||||
<li>requestScope - a Map that maps request-scoped attribute names
|
||||
to their values</li>
|
||||
<li>sessionScope - a Map that maps session-scoped attribute names
|
||||
to their values</li>
|
||||
<li>applicationScope - a Map that maps application-scoped attribute
|
||||
names to their values</li>
|
||||
<li>param - a Map that maps parameter names to a single String
|
||||
parameter value</li>
|
||||
<li>paramValues - a Map that maps parameter names to a String[] of
|
||||
all values for that parameter</li>
|
||||
<li>header - a Map that maps header names to a single String
|
||||
header value</li>
|
||||
<li>headerValues - a Map that maps header names to a String[] of
|
||||
all values for that header</li>
|
||||
<li>initParam - a Map that maps context initialization parameter
|
||||
names to their String parameter value</li>
|
||||
<li>cookie - a Map that maps cookie names to a single Cookie object.</li>
|
||||
</ul>
|
||||
|
||||
<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"])}">
|
||||
<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"])}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${param["foo"]}</td>
|
||||
<td>${fn:escapeXml(param["foo"])}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${header["host"]}</td>
|
||||
<td>${fn:escapeXml(header["host"])}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${header["accept"]}</td>
|
||||
<td>${fn:escapeXml(header["accept"])}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${header["user-agent"]}</td>
|
||||
<td>${fn:escapeXml(header["user-agent"])}&nbsp;</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
Reference in New Issue
Block a user