Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 771 | blopes | 1 | <!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%-- |
| 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="my" uri="http://tomcat.apache.org/example-taglib" %> |
||
| 18 | |||
| 19 | <html> |
||
| 20 | <head> |
||
| 21 | <title>JSP 2.0 Expression Language - Composite Expressions</title> |
||
| 22 | </head> |
||
| 23 | <body> |
||
| 24 | <h1>JSP 2.0 Expression Language - Composite Expressions</h1> |
||
| 25 | <hr> |
||
| 26 | This example illustrates EL composite expressions. Composite expressions |
||
| 27 | are formed by grouping together multiple EL expressions. Each of them is |
||
| 28 | evaluated from left to right, coerced to String, all those strings are |
||
| 29 | concatenated, and the result is coerced to the expected type. |
||
| 30 | |||
| 31 | <jsp:useBean id="values" class="jsp2.examples.ValuesBean" /> |
||
| 32 | |||
| 33 | <blockquote> |
||
| 34 | <code> |
||
| 35 | <table border="1"> |
||
| 36 | <thead> |
||
| 37 | <td><b>EL Expression</b></td> |
||
| 38 | <td><b>Type</b></td> |
||
| 39 | <td><b>Result</b></td> |
||
| 40 | </thead> |
||
| 41 | <tr> |
||
| 42 | <td>\${'hello'} wo\${'rld'}</td> |
||
| 43 | <td>String</td> |
||
| 44 | <td><jsp:setProperty name="values" property="stringValue" value="${'hello'} wo${'rld'}"/>${values.stringValue}</td> |
||
| 45 | </tr> |
||
| 46 | <tr> |
||
| 47 | <td>\${'hello'} wo\${'rld'}</td> |
||
| 48 | <td>String</td> |
||
| 49 | <td><my:values string="${'hello'} wo${'rld'}"/></td> |
||
| 50 | </tr> |
||
| 51 | <tr> |
||
| 52 | <td>\${1+2}.\${220}</td> |
||
| 53 | <td>Double</td> |
||
| 54 | <td><jsp:setProperty name="values" property="doubleValue" value="${1+2}.${220}"/>${values.doubleValue}</td> |
||
| 55 | </tr> |
||
| 56 | <tr> |
||
| 57 | <td>\${1+2}.\${220}</td> |
||
| 58 | <td>Double</td> |
||
| 59 | <td><my:values double="${1+2}.${220}"/></td> |
||
| 60 | </tr> |
||
| 61 | <tr> |
||
| 62 | <td>000\${1}\${7}</td> |
||
| 63 | <td>Long</td> |
||
| 64 | <td><jsp:setProperty name="values" property="longValue" value="000${1}${7}"/>${values.longValue}</td> |
||
| 65 | </tr> |
||
| 66 | <tr> |
||
| 67 | <td>000\${1}\${7}</td> |
||
| 68 | <td>Long</td> |
||
| 69 | <td><my:values long="000${1}${7}"/></td> |
||
| 70 | </tr> |
||
| 71 | <!-- |
||
| 72 | Undefined values are to be coerced to String, to be "", |
||
| 73 | https://bz.apache.org/bugzilla/show_bug.cgi?id=47413 |
||
| 74 | --> |
||
| 75 | <tr> |
||
| 76 | <td>\${undefinedFoo}hello world\${undefinedBar}</td> |
||
| 77 | <td>String</td> |
||
| 78 | <td><jsp:setProperty name="values" property="stringValue" value="${undefinedFoo}hello world${undefinedBar}"/>${values.stringValue}</td> |
||
| 79 | </tr> |
||
| 80 | <tr> |
||
| 81 | <td>\${undefinedFoo}hello world\${undefinedBar}</td> |
||
| 82 | <td>String</td> |
||
| 83 | <td><my:values string="${undefinedFoo}hello world${undefinedBar}"/></td> |
||
| 84 | </tr> |
||
| 85 | <tr> |
||
| 86 | <td>\${undefinedFoo}\${undefinedBar}</td> |
||
| 87 | <td>Double</td> |
||
| 88 | <td><jsp:setProperty name="values" property="doubleValue" value="${undefinedFoo}${undefinedBar}"/>${values.doubleValue}</td> |
||
| 89 | </tr> |
||
| 90 | <tr> |
||
| 91 | <td>\${undefinedFoo}\${undefinedBar}</td> |
||
| 92 | <td>Double</td> |
||
| 93 | <td><my:values double="${undefinedFoo}${undefinedBar}"/></td> |
||
| 94 | </tr> |
||
| 95 | <tr> |
||
| 96 | <td>\${undefinedFoo}\${undefinedBar}</td> |
||
| 97 | <td>Long</td> |
||
| 98 | <td><jsp:setProperty name="values" property="longValue" value="${undefinedFoo}${undefinedBar}"/>${values.longValue}</td> |
||
| 99 | </tr> |
||
| 100 | <tr> |
||
| 101 | <td>\${undefinedFoo}\${undefinedBar}</td> |
||
| 102 | <td>Long</td> |
||
| 103 | <td><my:values long="${undefinedFoo}${undefinedBar}"/></td> |
||
| 104 | </tr> |
||
| 105 | </table> |
||
| 106 | </code> |
||
| 107 | </blockquote> |
||
| 108 | </body> |
||
| 109 | </html> |
||
| 110 | |||
| 111 | </pre></body></html> |