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