Struts日历选择框 标签 详解
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
在<head> </head>中加入<sx:head />
下面的代码直接就实现了日历选择框:
[html]
<sx:datetimepicker label="日历" name="calendar" value="today"
toggletype="plain" toggleduration="300" language="zh_cn" type="date"
displayweeks="5" displayformat="dd/mm/yyyy" formatlength="long" />
parameters:
(注:toggle['tɒg(ə)l]触发)
最后的效果如下图:
value属性的写法还有:
<sx:datetimepicker value="%{date}"/>
<sx:datetimepicker value="%{'2007-01-01'}"/>
<sx:datetimepicker value="%{'today'}"/>
datetimepicker标签解析:
description:
renders a date/time picker in a dropdown(下拉) container.
a stand-alone datetimepicker widget(文本桌面) that makes it easy to select a date/time, or increment by week, month, and/or year.
it is possible to customize the user-visible formatting with either the 'formatlength' (long, short, medium or full) or 'displayformat' attributes. by defaulty current locale(区域设置) will be used.
参数displayformat的所有可能取值:
format description
d day of the month
d day of year
m month - use one or two for the numerical month, three for the abbreviation, or four for the full name, or 5 for the narrow name.
y year
h hour [1-12].
h hour [0-23].
m minute. use one or two for zero padding.
s second. use one or two for zero padding.
the following formats(in order) will be used to parse the values of the attributes 'value', 'startdate' and 'enddate':
simpledateformat built using rfc 3339 (yyyy-mm-dd't'hh:mm:ss)
simpledateformat.gettimeinstance(dateformat.short)
simpledateformat.getdateinstance(dateformat.short)
simpledateformat.getdateinstance(dateformat.medium)
simpledateformat.getdateinstance(dateformat.full)
simpledateformat.getdateinstance(dateformat.long)
simpledateformat built using the value of the 'displayformat' attribute(if any)
下一篇: 立秋之后该吃什么?吃什么才是最好的