|
Struts2 Tags |
|
private Date myBirthday;
public String execute() throws Exception{
setMyBirthday(new Date(“Jan 12, 1984
11:21:30 AM”));
return SUCCESS;
}
public void setMyBirthday(Date date){
this.myBirthday = date;
}
public Date getMyBirthday(){
return myBirthday;
}
} |
Create a jsp using the
tag<s:datetimepicker>
This tag renders a date/time picker in a
dropdown container.
The tag <s:datetimepicker name=”myBirthday”
label=”My Birth Day (dd-MM-yyyy)”
displayFormat=”dd-MM-yyyy” /> picks the data
from the action class “includeTag” using the
parameter name=”myBirthday” using the
display format as displayFormat=”dd-MM-yyyy”.
datetimepickerTag.jsp
<%@ taglib prefix=”s” uri=”/struts-tags” %>
<html>
<head>
<title>Datetimepicker (Form Tag) Tag
Example</title>
<s:head theme=”ajax” />
</head>
<body>
<h2>Datetimepicker Tag Example</h2>
<s:datetimepicker name=”myBirthday”
label=”Select date:(dd-MM-yyyy)”
displayFormat=”dd-MM-yyyy” />
</body>
</html> |
|
|
Output of the datetimepickerTag.jsp:
6. Doubleselect Tag (Form Tag) Example
The doubleselect tag is a UI tag that renders
two HTML select elements with second one
changing displayed values depending on
selected entry of first one.
Add the following code snippet into the
struts.xml file
<action name=”doubleselectTag”>
<result>/pages/formTags/
doubleselectTag.jsp</result>
</action>
Create a jsp using the tag <s:doubleselect>
This tag renders two HTML select elements with
second one changing displayed values
depending on selected entry of first one. This
tag contains various parameters:
The headerKey parameter sets the header key
of the second list. Must not be empty. In our
case we have set it to”1"
The headerValue parameter sets the header
value of the second list. In our case we have
set it to “— Please Select —”
The doubleName parameter sets the name for
complete component. In our case we have set
it as : doubleName=”dishes”
The doubleList sets the second iterable source
to populate from. In our case we have set it as:
doubleList=”top == ‘Color’ ?
{‘Black’,’Green’,’White’,
‘Yellow’,’Red’,’Pink’} :
{
‘Apple’,’Banana’,’Grapes’,’Mango’}”
doubleselectTag.jsp
<%@ taglib prefix=”s” uri=”/struts-tags” %>
<html>
<head> |
|
Fab 2008 | Java Jazz Up | 42 |
|
|
|
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 |
|
|
|
|
|
|
|
|
|