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