将下載下傳好的struts2-dojo-plugin-2.1.6.jar導入WEB-INF/lib
在web.xml中增加
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
</filter-mapping>
在jsp頁面上
引用标簽
<%@ taglib prefix="sd" uri="/struts-dojo-tags" %>
在<head></head>中添加
<s:head theme="xhtml"/>
<sd:head parseContent="true"/>
并去掉<base href="<%=basePath%>" target="_blank" rel="external nofollow" >
之後在頁面上使用<sd:datetimepicker toggleType="explode" value="today" formatLength="long" />即可
常用屬性:
·displayFormat:指定日期顯示格式,如dd/MM/yyy
·displayWeeks:指定該月曆能顯示星期書
·endDate:指定日期集的最後可用日期
·formatLength:指定日期顯示的格式,這些格式就是DateFormat中的格式,該屬性支援的值有long、short、medium和full
·language:指定日期顯示的Locale
·startDate:指定日期集的最初可用日期
·toggleDuration:指定日期選擇框出現、隐藏的切換時間
·toggleType:指定日期選擇框出現、隐藏的方式,可以選擇plain、wipe、explode和fade
·type:指定日期選擇框類型,支援的值有date和time,分别代表日期選擇框、時間選擇框
·value:指定目前日期、時間。可使用today代表今天
·weekStartsOn:指定日期選擇框中哪一天才是一周的第一天。周日是0,周六是6