| 1 | <html><body><pre> | 
|---|
| 2 | <!-- | 
|---|
| 3 |  Licensed to the Apache Software Foundation (ASF) under one or more | 
|---|
| 4 |   contributor license agreements.  See the NOTICE file distributed with | 
|---|
| 5 |   this work for additional information regarding copyright ownership. | 
|---|
| 6 |   The ASF licenses this file to You under the Apache License, Version 2.0 | 
|---|
| 7 |   (the "License"); you may not use this file except in compliance with | 
|---|
| 8 |   the License.  You may obtain a copy of the License at | 
|---|
| 9 |  | 
|---|
| 10 |       http://www.apache.org/licenses/LICENSE-2.0 | 
|---|
| 11 |  | 
|---|
| 12 |   Unless required by applicable law or agreed to in writing, software | 
|---|
| 13 |   distributed under the License is distributed on an "AS IS" BASIS, | 
|---|
| 14 |   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|---|
| 15 |   See the License for the specific language governing permissions and | 
|---|
| 16 |   limitations under the License. | 
|---|
| 17 | --> | 
|---|
| 18 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> | 
|---|
| 19 | <%@ taglib prefix="my" uri="http://jakarta.apache.org/tomcat/jsp2-example-taglib"%> | 
|---|
| 20 |  | 
|---|
| 21 | <html> | 
|---|
| 22 |   <head> | 
|---|
| 23 |     <title>JSP 2.0 Expression Language - Functions</title> | 
|---|
| 24 |   </head> | 
|---|
| 25 |   <body> | 
|---|
| 26 |     <h1>JSP 2.0 Expression Language - Functions</h1> | 
|---|
| 27 |     <hr> | 
|---|
| 28 |     An upgrade from the JSTL expression language, the JSP 2.0 EL also | 
|---|
| 29 |     allows for simple function invocation.  Functions are defined | 
|---|
| 30 |     by tag libraries and are implemented by a Java programmer as  | 
|---|
| 31 |     static methods. | 
|---|
| 32 |  | 
|---|
| 33 |     <blockquote> | 
|---|
| 34 |       <u><b>Change Parameter</b></u> | 
|---|
| 35 |       <form action="functions.jsp" method="GET"> | 
|---|
| 36 |     foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}"> | 
|---|
| 37 |           <input type="submit"> | 
|---|
| 38 |       </form> | 
|---|
| 39 |       <br> | 
|---|
| 40 |       <code> | 
|---|
| 41 |         <table border="1"> | 
|---|
| 42 |           <thead> | 
|---|
| 43 |       <td><b>EL Expression</b></td> | 
|---|
| 44 |       <td><b>Result</b></td> | 
|---|
| 45 |     </thead> | 
|---|
| 46 |     <tr> | 
|---|
| 47 |       <td>\${param["foo"]}</td> | 
|---|
| 48 |       <td>${fn:escapeXml(param["foo"])}&nbsp;</td> | 
|---|
| 49 |     </tr> | 
|---|
| 50 |     <tr> | 
|---|
| 51 |       <td>\${my:reverse(param["foo"])}</td> | 
|---|
| 52 |       <td>${my:reverse(fn:escapeXml(param["foo"]))}&nbsp;</td> | 
|---|
| 53 |     </tr> | 
|---|
| 54 |     <tr> | 
|---|
| 55 |       <td>\${my:reverse(my:reverse(param["foo"]))}</td> | 
|---|
| 56 |       <td>${my:reverse(my:reverse(fn:escapeXml(param["foo"])))}&nbsp;</td> | 
|---|
| 57 |     </tr> | 
|---|
| 58 |     <tr> | 
|---|
| 59 |       <td>\${my:countVowels(param["foo"])}</td> | 
|---|
| 60 |       <td>${my:countVowels(fn:escapeXml(param["foo"]))}&nbsp;</td> | 
|---|
| 61 |     </tr> | 
|---|
| 62 |   </table> | 
|---|
| 63 |       </code> | 
|---|
| 64 |     </blockquote> | 
|---|
| 65 |   </body> | 
|---|
| 66 | </html> | 
|---|
| 67 |  | 
|---|
| 68 | </pre></body></html> | 
|---|