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