[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="tags" tagdir="/WEB-INF/tags" %> |
---|
| 19 | <html> |
---|
| 20 | <head> |
---|
| 21 | <title>JSP 2.0 Examples - Display Products Tag File</title> |
---|
| 22 | </head> |
---|
| 23 | <body> |
---|
| 24 | <h1>JSP 2.0 Examples - Display Products Tag File</h1> |
---|
| 25 | <hr> |
---|
| 26 | <p>This JSP page invokes a tag file that displays a listing of |
---|
| 27 | products. The custom tag accepts two fragments that enable |
---|
| 28 | customization of appearance. One for when the product is on sale |
---|
| 29 | and one for normal price.</p> |
---|
| 30 | <p>The tag is invoked twice, using different styles</p> |
---|
| 31 | <hr> |
---|
| 32 | <h2>Products</h2> |
---|
| 33 | <tags:displayProducts> |
---|
| 34 | <jsp:attribute name="normalPrice"> |
---|
| 35 | Item: ${name}<br/> |
---|
| 36 | Price: ${price} |
---|
| 37 | </jsp:attribute> |
---|
| 38 | <jsp:attribute name="onSale"> |
---|
| 39 | Item: ${name}<br/> |
---|
| 40 | <font color="red"><strike>Was: ${origPrice}</strike></font><br/> |
---|
| 41 | <b>Now: ${salePrice}</b> |
---|
| 42 | </jsp:attribute> |
---|
| 43 | </tags:displayProducts> |
---|
| 44 | <hr> |
---|
| 45 | <h2>Products (Same tag, alternate style)</h2> |
---|
| 46 | <tags:displayProducts> |
---|
| 47 | <jsp:attribute name="normalPrice"> |
---|
| 48 | <b>${name}</b> @ ${price} ea. |
---|
| 49 | </jsp:attribute> |
---|
| 50 | <jsp:attribute name="onSale"> |
---|
| 51 | <b>${name}</b> @ ${salePrice} ea. (was: ${origPrice}) |
---|
| 52 | </jsp:attribute> |
---|
| 53 | </tags:displayProducts> |
---|
| 54 | </body> |
---|
| 55 | </html> |
---|
| 56 | </pre></body></html> |
---|