Seventh study: 1. iteration display content
Java code:
1
2
3 <% @ Taglib URI = "/ Tags / Struts-Bean" prefix = "bean"%>
4 <% @ Taglib Uri = "/ Tags / Struts-Logic" prefix = "logic"%>
5
6
7
8 hEAD>
9
10 Define LIST variables
11%
12
{
...}
13 Java.
Util.
ArrayList List =
New java.
Util.
ArrayList
(
);
14 List.
Add
("First"
);
15 List.
Add
("SECOND"
);
16 List.
Add
("Third"
);
17 List.
Add
("Fourth"
);
18 List.
Add
("Fiffh"
);
19
20 pagecontext.
SetaTribute
("List", List, GeContext.
Page_scope
);
21 definition array
twenty two
Int IntaRray
[
] =
New
int
[
]
twenty three
{
0,
10,
20,
30,
40
}
24 pagecontext.
SetaTribute
("INTARRAY", INTARRAY, PageContext.
Page_scope
);
25
}
26%>
27
28
29 div>
30 instantiate bean
31 Class = "ORG. Apache. Struts. WebApp. EXERCISE. TestBean "/> 32 Class = "Java. Util. ArrayList "/> 33 1 - Iterate Display String array [ 0 .. 4 ] h3> 34 test
35
36
37
38
39 em>
[
40
] li>
41 logic: Iterate>
42 ol>
43
2 - Iterate display array
[
0 ..
2
] h3>
44
45
46
47
48
49 em>
[
50
] li>
51 logic: Iterate>
52 ol>
53
3 - Iterate display array
[
3 ..
4
] h3>
54
55
56
57
58
59 em>
[
60
] li>
61 logic: Iterate>
62 ol>
63
4 - Iterate display array
[
1..
3
] h3>
64
65
66
67
68
69 em>
[
70
71 logic: Iterate>
72 ol>
73
5 - Iterate display
List h3>
74
75
76
77
78
79 em>
[
80
] li>
81 logic: Iterate>
82 ol>
83
6 - Iterate display
List
[
0 ..
2
] h3>
84
85
86
87
88
89 em>
[
90
] li>
91 logic: Iterate>
92 ol>
93
7 - Iterate display
List
[
2..
4
] h3>
94
95
96
97
98
99 em>
[
100
] li>
101 logic: Itereate>
102 ol>
103
8 - Iterage over an
Int arch h3>
104
105
107
108
109 em>
[
110
] li>
111 logic: Iterate>
112 ol>
113
9 - Iterage over an
Int Array
[
0 ..
2
] h3>
114
115
116
117
118
119 em>
[
120
] li>
121 logic: Iterate>
122 ol>
123
10 - Iterage over an
Int Array
[
2..
4
] h3>
124
125
126
127
128
129 em>
[
130
] li>
131 logic: Iterate>
132 ol>
133 body>
134 html>
135