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