|
Struts2 Tags |
|
ActionSupport{
private List fruits;
private List animals;
public String execute()throws Exception{
fruits = new ArrayList();
fruits.add(“Apple”);
fruits.add(“Mango”);
fruits.add(“Orange”);
fruits.add(“Pine Apple”);
animals = new ArrayList();
animals.add(“Dog”);
animals.add(“Elephant”);
animals.add(“Ox”);
animals.add(“Fox”);
return SUCCESS;
}
public List getFruits(){
return fruits;
}
public List getAnimals(){
return animals;
}
}
Create a jsp using the tag <s:radio> It renders
a radio button input field.
radioTag.jsp
<%@ taglib prefix=”s” uri=”/struts-tags” %>
<html>
<head>
<title>Radio Tag Example!</title>
</head>
<body>
<h2>Radio Tag Example</h2>
<s:form>
<s:radio label=”Fruits” name=”fruitsname”
list=”fruits” />
<s:radio label=”Animals”
name=”animalsname” list=”animals” />
</s:form>
</body>
</html>
|
|
Output of the radioTag.jsp:
14. Reset Tag (Form Tag) Example
The reset tag is a UI tag that is used together
with the form tag to provide form resetting.
It renders a reset button.
The reset can have two different types of
rendering:
input: renders as html <input type=”reset”...>
button: renders as html <button
type=”reset”...>
The button type has advantages as it adds the
possibility to separate the submitted value from
the text shown on the button face.
Add the following code snippet into the
struts.xml file
<action name=”resetTag”>
<result>/pages/formTags/resetTag.jsp</
result>
</action>
Create a jsp using the tag <s:reset>
It renders a reset button which provides the
form resetting .
resetTag.jsp
<%@ taglib prefix=”s” uri=”/struts-tags” %>
<html>
<head>
<title>Reset Tag Example!</title>
</head>
<body> |
|
Feb 2008 | Java Jazz Up | 48 |
|
|
|
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 ,
Download PDF |
|
|
|
|
|
|
|
|
|