[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="my" uri="http://jakarta.apache.org/tomcat/jsp2-example-taglib"%> |
---|
| 18 | |
---|
| 19 | <html> |
---|
| 20 | <head> |
---|
| 21 | <title>JSP 2.0 Examples - Shuffle Example</title> |
---|
| 22 | </head> |
---|
| 23 | <body> |
---|
| 24 | <h1>JSP 2.0 Examples - Shuffle Example</h1> |
---|
| 25 | <hr> |
---|
| 26 | <p>Try reloading the page a few times. Both the rows and the columns |
---|
| 27 | are shuffled and appear different each time.</p> |
---|
| 28 | <p>Here's how the code works. The SimpleTag handler called |
---|
| 29 | <my:shuffle> accepts three attributes. Each attribute is a |
---|
| 30 | JSP Fragment, meaning it is a fragment of JSP code that can be |
---|
| 31 | dynamically executed by the shuffle tag handler on demand. The |
---|
| 32 | shuffle tag handler executes the three fragments in a random order. |
---|
| 33 | To shuffle both the rows and the columns, the shuffle tag is used |
---|
| 34 | with itself as a parameter.</p> |
---|
| 35 | <hr> |
---|
| 36 | <blockquote> |
---|
| 37 | <font color="#ffffff"> |
---|
| 38 | <table> |
---|
| 39 | <my:shuffle> |
---|
| 40 | <jsp:attribute name="fragment1"> |
---|
| 41 | <tr> |
---|
| 42 | <my:shuffle> |
---|
| 43 | <jsp:attribute name="fragment1"> |
---|
| 44 | <my:tile color="#ff0000" label="A"/> |
---|
| 45 | </jsp:attribute> |
---|
| 46 | <jsp:attribute name="fragment2"> |
---|
| 47 | <my:tile color="#00ff00" label="B"/> |
---|
| 48 | </jsp:attribute> |
---|
| 49 | <jsp:attribute name="fragment3"> |
---|
| 50 | <my:tile color="#0000ff" label="C"/> |
---|
| 51 | </jsp:attribute> |
---|
| 52 | </my:shuffle> |
---|
| 53 | </tr> |
---|
| 54 | </jsp:attribute> |
---|
| 55 | <jsp:attribute name="fragment2"> |
---|
| 56 | <tr> |
---|
| 57 | <my:shuffle> |
---|
| 58 | <jsp:attribute name="fragment1"> |
---|
| 59 | <my:tile color="#ff0000" label="1"/> |
---|
| 60 | </jsp:attribute> |
---|
| 61 | <jsp:attribute name="fragment2"> |
---|
| 62 | <my:tile color="#00ff00" label="2"/> |
---|
| 63 | </jsp:attribute> |
---|
| 64 | <jsp:attribute name="fragment3"> |
---|
| 65 | <my:tile color="#0000ff" label="3"/> |
---|
| 66 | </jsp:attribute> |
---|
| 67 | </my:shuffle> |
---|
| 68 | </tr> |
---|
| 69 | </jsp:attribute> |
---|
| 70 | <jsp:attribute name="fragment3"> |
---|
| 71 | <tr> |
---|
| 72 | <my:shuffle> |
---|
| 73 | <jsp:attribute name="fragment1"> |
---|
| 74 | <my:tile color="#ff0000" label="!"/> |
---|
| 75 | </jsp:attribute> |
---|
| 76 | <jsp:attribute name="fragment2"> |
---|
| 77 | <my:tile color="#00ff00" label="@"/> |
---|
| 78 | </jsp:attribute> |
---|
| 79 | <jsp:attribute name="fragment3"> |
---|
| 80 | <my:tile color="#0000ff" label="#"/> |
---|
| 81 | </jsp:attribute> |
---|
| 82 | </my:shuffle> |
---|
| 83 | </tr> |
---|
| 84 | </jsp:attribute> |
---|
| 85 | </my:shuffle> |
---|
| 86 | </table> |
---|
| 87 | </font> |
---|
| 88 | </blockquote> |
---|
| 89 | </body> |
---|
| 90 | </html> |
---|