source: nutchez-0.1/tomcat/webapps/examples/jsp/jsp2/jspattribute/shuffle.jsp.html

Last change on this file was 66, checked in by waue, 15 years ago

NutchEz - an easy way to nutch

File size: 3.7 KB
Line 
1<html><body><pre>
2&lt;!--
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&lt;%@ taglib prefix="my" uri="http://jakarta.apache.org/tomcat/jsp2-example-taglib"%>
19
20&lt;html>
21  &lt;head>
22    &lt;title>JSP 2.0 Examples - Shuffle Example&lt;/title>
23  &lt;/head>
24  &lt;body>
25    &lt;h1>JSP 2.0 Examples - Shuffle Example&lt;/h1>
26    &lt;hr>
27    &lt;p>Try reloading the page a few times.  Both the rows and the columns
28    are shuffled and appear different each time.&lt;/p>
29    &lt;p>Here's how the code works.  The SimpleTag handler called
30    &amp;lt;my:shuffle&amp;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.&lt;/p>
36    &lt;hr>
37    &lt;blockquote>
38     &lt;font color="#ffffff">
39      &lt;table>
40        &lt;my:shuffle>
41          &lt;jsp:attribute name="fragment1">
42            &lt;tr>
43              &lt;my:shuffle>
44                &lt;jsp:attribute name="fragment1">
45                  &lt;my:tile color="#ff0000" label="A"/>
46                &lt;/jsp:attribute>
47                &lt;jsp:attribute name="fragment2">
48                  &lt;my:tile color="#00ff00" label="B"/>
49                &lt;/jsp:attribute>
50                &lt;jsp:attribute name="fragment3">
51                  &lt;my:tile color="#0000ff" label="C"/>
52                &lt;/jsp:attribute>
53              &lt;/my:shuffle>
54            &lt;/tr>
55          &lt;/jsp:attribute>
56          &lt;jsp:attribute name="fragment2">
57            &lt;tr>
58              &lt;my:shuffle>
59                &lt;jsp:attribute name="fragment1">
60                  &lt;my:tile color="#ff0000" label="1"/>
61                &lt;/jsp:attribute>
62                &lt;jsp:attribute name="fragment2">
63                  &lt;my:tile color="#00ff00" label="2"/>
64                &lt;/jsp:attribute>
65                &lt;jsp:attribute name="fragment3">
66                  &lt;my:tile color="#0000ff" label="3"/>
67                &lt;/jsp:attribute>
68              &lt;/my:shuffle>
69            &lt;/tr>
70          &lt;/jsp:attribute>
71          &lt;jsp:attribute name="fragment3">
72            &lt;tr>
73              &lt;my:shuffle>
74                &lt;jsp:attribute name="fragment1">
75                  &lt;my:tile color="#ff0000" label="!"/>
76                &lt;/jsp:attribute>
77                &lt;jsp:attribute name="fragment2">
78                  &lt;my:tile color="#00ff00" label="@"/>
79                &lt;/jsp:attribute>
80                &lt;jsp:attribute name="fragment3">
81                  &lt;my:tile color="#0000ff" label="#"/>
82                &lt;/jsp:attribute>
83              &lt;/my:shuffle>
84            &lt;/tr>
85          &lt;/jsp:attribute>
86        &lt;/my:shuffle>
87      &lt;/table>
88     &lt;/font>
89    &lt;/blockquote>
90  &lt;/body>
91&lt;/html>
92</pre></body></html>
Note: See TracBrowser for help on using the repository browser.