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