[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 | |
---|
| 19 | <html> |
---|
| 20 | <head> |
---|
| 21 | <title>JSP 2.0 Expression Language - Implicit Objects</title> |
---|
| 22 | </head> |
---|
| 23 | <body> |
---|
| 24 | <h1>JSP 2.0 Expression Language - Implicit Objects</h1> |
---|
| 25 | <hr> |
---|
| 26 | This example illustrates some of the implicit objects available |
---|
| 27 | in the Expression Lanaguage. The following implicit objects are |
---|
| 28 | available (not all illustrated here): |
---|
| 29 | <ul> |
---|
| 30 | <li>pageContext - the PageContext object</li> |
---|
| 31 | <li>pageScope - a Map that maps page-scoped attribute names to |
---|
| 32 | their values</li> |
---|
| 33 | <li>requestScope - a Map that maps request-scoped attribute names |
---|
| 34 | to their values</li> |
---|
| 35 | <li>sessionScope - a Map that maps session-scoped attribute names |
---|
| 36 | to their values</li> |
---|
| 37 | <li>applicationScope - a Map that maps application-scoped attribute |
---|
| 38 | names to their values</li> |
---|
| 39 | <li>param - a Map that maps parameter names to a single String |
---|
| 40 | parameter value</li> |
---|
| 41 | <li>paramValues - a Map that maps parameter names to a String[] of |
---|
| 42 | all values for that parameter</li> |
---|
| 43 | <li>header - a Map that maps header names to a single String |
---|
| 44 | header value</li> |
---|
| 45 | <li>headerValues - a Map that maps header names to a String[] of |
---|
| 46 | all values for that header</li> |
---|
| 47 | <li>initParam - a Map that maps context initialization parameter |
---|
| 48 | names to their String parameter value</li> |
---|
| 49 | <li>cookie - a Map that maps cookie names to a single Cookie object.</li> |
---|
| 50 | </ul> |
---|
| 51 | |
---|
| 52 | <blockquote> |
---|
| 53 | <u><b>Change Parameter</b></u> |
---|
| 54 | <form action="implicit-objects.jsp" method="GET"> |
---|
| 55 | foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}"> |
---|
| 56 | <input type="submit"> |
---|
| 57 | </form> |
---|
| 58 | <br> |
---|
| 59 | <code> |
---|
| 60 | <table border="1"> |
---|
| 61 | <thead> |
---|
| 62 | <td><b>EL Expression</b></td> |
---|
| 63 | <td><b>Result</b></td> |
---|
| 64 | </thead> |
---|
| 65 | <tr> |
---|
| 66 | <td>\${param.foo}</td> |
---|
| 67 | <td>${fn:escapeXml(param["foo"])} </td> |
---|
| 68 | </tr> |
---|
| 69 | <tr> |
---|
| 70 | <td>\${param["foo"]}</td> |
---|
| 71 | <td>${fn:escapeXml(param["foo"])} </td> |
---|
| 72 | </tr> |
---|
| 73 | <tr> |
---|
| 74 | <td>\${header["host"]}</td> |
---|
| 75 | <td>${fn:escapeXml(header["host"])} </td> |
---|
| 76 | </tr> |
---|
| 77 | <tr> |
---|
| 78 | <td>\${header["accept"]}</td> |
---|
| 79 | <td>${fn:escapeXml(header["accept"])} </td> |
---|
| 80 | </tr> |
---|
| 81 | <tr> |
---|
| 82 | <td>\${header["user-agent"]}</td> |
---|
| 83 | <td>${fn:escapeXml(header["user-agent"])} </td> |
---|
| 84 | </tr> |
---|
| 85 | </table> |
---|
| 86 | </code> |
---|
| 87 | </blockquote> |
---|
| 88 | </body> |
---|
| 89 | </html> |
---|