| [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="my" uri="http://jakarta.apache.org/tomcat/jsp2-example-taglib"%> | 
|---|
|  | 19 |  | 
|---|
|  | 20 | <html> | 
|---|
|  | 21 | <head> | 
|---|
|  | 22 | <title>JSP 2.0 Examples - jsp:attribute and jsp:body</title> | 
|---|
|  | 23 | </head> | 
|---|
|  | 24 | <body> | 
|---|
|  | 25 | <h1>JSP 2.0 Examples - jsp:attribute and jsp:body</h1> | 
|---|
|  | 26 | <hr> | 
|---|
|  | 27 | <p>The new &lt;jsp:attribute&gt; and &lt;jsp:body&gt; | 
|---|
|  | 28 | standard actions can be used to specify the value of any standard | 
|---|
|  | 29 | action or custom action attribute.</p> | 
|---|
|  | 30 | <p>This example uses the &lt;jsp:attribute&gt; | 
|---|
|  | 31 | standard action to use the output of a custom action invocation | 
|---|
|  | 32 | (one that simply outputs "Hello, World!") to set the value of a | 
|---|
|  | 33 | bean property.  This would normally require an intermediary | 
|---|
|  | 34 | step, such as using JSTL's &lt;c:set&gt; action.</p> | 
|---|
|  | 35 | <br> | 
|---|
|  | 36 | <jsp:useBean id="foo" class="jsp2.examples.FooBean"> | 
|---|
|  | 37 | Bean created!  Setting foo.bar...<br> | 
|---|
|  | 38 | <jsp:setProperty name="foo" property="bar"> | 
|---|
|  | 39 | <jsp:attribute name="value"> | 
|---|
|  | 40 | <my:helloWorld/> | 
|---|
|  | 41 | </jsp:attribute> | 
|---|
|  | 42 | </jsp:setProperty> | 
|---|
|  | 43 | </jsp:useBean> | 
|---|
|  | 44 | <br> | 
|---|
|  | 45 | Result: ${foo.bar} | 
|---|
|  | 46 | </body> | 
|---|
|  | 47 | </html> | 
|---|
|  | 48 | </pre></body></html> | 
|---|