|
Struts2 Tags |
|
list2.add(“Managing Director”);
return SUCCESS;
}
public List getList1(){
return list1;
}
public List getList2(){
return list2;
}
}
Now create a jsp page using <s:append> and <s:iterator> tags as shown in the
AppendTag.jsp page. The append tag is
used to merge multiple iterators into one
iterator. The “id” parameter keeps the
resultant appended iterator stored under the
stack’s context and the “value” parameter is
used to get the values contained within the
resultant iterator.
AppendTag.jsp
<%@ taglib prefix=”s” uri=”/struts-tags” %>
<html>
<head>
<title> Append Tag Example</title>
</head>
<body>
<h2>Append Tag Example</h2>
<s:append id=”myAppendList”>
<s:param value=”%{list1}” />
<s:param value=”%{list2}” />
</s:append>
<s:iterator value=”%{#myAppendList}”>
<s:property /><br>
</s:iterator>
</body>
</html>
Output:
|
|
3. Iterator Tag (Control Tags) Example
Iterator tag is used to iterate over a value.
An iterable value can be either of:
java.util.Collection, java.util.Iterator.
IteratorTag.java
package net.javajazzup;
import
com.opensymphony.xwork2.ActionSupport;
import java.util.*;
public class IteratorTag extends
ActionSupport{
private List list1;
private List list2;
public String execute()throws Exception{
list1 = new ArrayList();
list1.add(“Samsung”);
list1.add(“LG”);
list1.add(“Intel”);
list1.add(“BenQ”);
|
|
Dec 2007 | Java Jazz Up | 43 |
|
|
|
View All Topics |
All Pages of this Issue |
Pages:
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53 ,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63 ,
64,
65 ,
66 ,
67 ,
68 ,
69 ,
70 ,
71 ,
72 ,
73 ,
74 ,
75 ,
76 ,
77 ,
78 ,
79 ,
80 ,
81 ,
82 , Download PDF |
|
|
|
|
|
|
|
|
|