Subversion Repositories Integrator Subversion

Rev

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>&lt;%--
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
&lt;%@ taglib prefix="my" uri="http://tomcat.apache.org/example-taglib" %>
18
 
19
&lt;html>
20
  &lt;head>
21
    &lt;title>JSP 2.0 Expression Language - Composite Expressions&lt;/title>
22
  &lt;/head>
23
  &lt;body>
24
    &lt;h1>JSP 2.0 Expression Language - Composite Expressions&lt;/h1>
25
    &lt;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
    &lt;jsp:useBean id="values" class="jsp2.examples.ValuesBean" />
32
 
33
    &lt;blockquote>
34
      &lt;code>
35
        &lt;table border="1">
36
          &lt;thead>
37
        &lt;td>&lt;b>EL Expression&lt;/b>&lt;/td>
38
        &lt;td>&lt;b>Type&lt;/b>&lt;/td>
39
        &lt;td>&lt;b>Result&lt;/b>&lt;/td>
40
      &lt;/thead>
41
      &lt;tr>
42
        &lt;td>\${'hello'} wo\${'rld'}&lt;/td>
43
        &lt;td>String&lt;/td>
44
        &lt;td>&lt;jsp:setProperty name="values" property="stringValue" value="${'hello'} wo${'rld'}"/>${values.stringValue}&lt;/td>
45
      &lt;/tr>
46
      &lt;tr>
47
        &lt;td>\${'hello'} wo\${'rld'}&lt;/td>
48
        &lt;td>String&lt;/td>
49
        &lt;td>&lt;my:values string="${'hello'} wo${'rld'}"/>&lt;/td>
50
      &lt;/tr>
51
      &lt;tr>
52
        &lt;td>\${1+2}.\${220}&lt;/td>
53
        &lt;td>Double&lt;/td>
54
        &lt;td>&lt;jsp:setProperty name="values" property="doubleValue" value="${1+2}.${220}"/>${values.doubleValue}&lt;/td>
55
      &lt;/tr>
56
      &lt;tr>
57
        &lt;td>\${1+2}.\${220}&lt;/td>
58
        &lt;td>Double&lt;/td>
59
        &lt;td>&lt;my:values double="${1+2}.${220}"/>&lt;/td>
60
      &lt;/tr>
61
      &lt;tr>
62
        &lt;td>000\${1}\${7}&lt;/td>
63
        &lt;td>Long&lt;/td>
64
        &lt;td>&lt;jsp:setProperty name="values" property="longValue" value="000${1}${7}"/>${values.longValue}&lt;/td>
65
      &lt;/tr>
66
      &lt;tr>
67
        &lt;td>000\${1}\${7}&lt;/td>
68
        &lt;td>Long&lt;/td>
69
        &lt;td>&lt;my:values long="000${1}${7}"/>&lt;/td>
70
      &lt;/tr>
71
      &lt;!--
72
         Undefined values are to be coerced to String, to be "",
73
         https://bz.apache.org/bugzilla/show_bug.cgi?id=47413
74
       -->
75
      &lt;tr>
76
        &lt;td>\${undefinedFoo}hello world\${undefinedBar}&lt;/td>
77
        &lt;td>String&lt;/td>
78
        &lt;td>&lt;jsp:setProperty name="values" property="stringValue" value="${undefinedFoo}hello world${undefinedBar}"/>${values.stringValue}&lt;/td>
79
      &lt;/tr>
80
      &lt;tr>
81
        &lt;td>\${undefinedFoo}hello world\${undefinedBar}&lt;/td>
82
        &lt;td>String&lt;/td>
83
        &lt;td>&lt;my:values string="${undefinedFoo}hello world${undefinedBar}"/>&lt;/td>
84
      &lt;/tr>
85
      &lt;tr>
86
        &lt;td>\${undefinedFoo}\${undefinedBar}&lt;/td>
87
        &lt;td>Double&lt;/td>
88
        &lt;td>&lt;jsp:setProperty name="values" property="doubleValue" value="${undefinedFoo}${undefinedBar}"/>${values.doubleValue}&lt;/td>
89
      &lt;/tr>
90
      &lt;tr>
91
        &lt;td>\${undefinedFoo}\${undefinedBar}&lt;/td>
92
        &lt;td>Double&lt;/td>
93
        &lt;td>&lt;my:values double="${undefinedFoo}${undefinedBar}"/>&lt;/td>
94
      &lt;/tr>
95
      &lt;tr>
96
        &lt;td>\${undefinedFoo}\${undefinedBar}&lt;/td>
97
        &lt;td>Long&lt;/td>
98
        &lt;td>&lt;jsp:setProperty name="values" property="longValue" value="${undefinedFoo}${undefinedBar}"/>${values.longValue}&lt;/td>
99
      &lt;/tr>
100
      &lt;tr>
101
        &lt;td>\${undefinedFoo}\${undefinedBar}&lt;/td>
102
        &lt;td>Long&lt;/td>
103
        &lt;td>&lt;my:values long="${undefinedFoo}${undefinedBar}"/>&lt;/td>
104
      &lt;/tr>
105
    &lt;/table>
106
      &lt;/code>
107
    &lt;/blockquote>
108
  &lt;/body>
109
&lt;/html>
110
 
111
</pre></body></html>