環境是使用 struts-2.2.1.1 在 lib 增加 struts2-dojo-plugin-2.2.1.1.jar 後就可以使用 DateTimePicker 來輸入日期.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/struts-dojo-tags" prefix="sx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>DateTimePicker Test</title>
<s:head />
<sx:head />
</head>
<body>
<center>
<s:form method="post" >
<sx:datetimepicker name="member.birthday" label="出生日" displayFormat="yyyy/MM/dd" />
<tr><td> </td><td><s:submit action="memberSave" value="Save" /></td></tr>
</s:form>

</center>
</body>
</html>

官方資料:
http://struts.apache.org/2.x/docs/datetimepicker.html
http://struts.apache.org/2.2.1.1/docs/datetimepicker.html