Struts2 日历选择框 标签<sx:datetimepicker.../>详解
2012-12-28 23:46
447 查看
先导入struts2-dojo-plugin-2.1.6.jar,再在jsp页面最开头加上:
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
在<html> </html>中加入<sx:head />:head标签的功能是生成页面文件的HEAD部分,它还生成了对Ajax框架dojo的配置文件的引用或代码。
下面的代码直接就实现了日历选择框:
Parameters:
![](http://img.my.csdn.net/uploads/201212/28/1356709675_1713.png)
(注:toggle['tɒg(ə)l]触发)
最后的效果如下图:
![](http://img.my.csdn.net/uploads/201212/28/1356708145_3137.png)
value属性的写法还有:
<sx:datetimepicker value="%{date}"/>
<sx:datetimepicker value="%{'2007-01-01'}"/>
<sx:datetimepicker value="%{'today'}"/>
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的所有可能取值:
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)
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
在<html> </html>中加入<sx:head />:head标签的功能是生成页面文件的HEAD部分,它还生成了对Ajax框架dojo的配置文件的引用或代码。
下面的代码直接就实现了日历选择框:
<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:
![](http://img.my.csdn.net/uploads/201212/28/1356709675_1713.png)
(注:toggle['tɒg(ə)l]触发)
最后的效果如下图:
![](http://img.my.csdn.net/uploads/201212/28/1356708145_3137.png)
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. |
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)
相关文章推荐
- Struts日历选择框 标签<sx:datetimepicker.../>详解
- Struts标签<s:action>的使用详解
- Struts2 的<s:iterator> 标签详解
- struts的<s:select>标签
- Struts标签<s:if>比较字符窜
- html中的<mata>标签详解
- struts <s:if>标签中获取session
- jsp页面中jstl标签详解 包括< c:choose><c:foreach> <c:when> <c:otherwise>
- js日历与onbeforeunload不兼容?非跳转用<a>标签的href屏蔽法
- struts2 防止表单重复提交主要用的到标签是<s: token />
- Struts2 ognl <s:action.../>标签详解(两种实现方式)
- struts.xml(三)<result>标签详解,跳转
- 关于JSP中单击任意标签弹出文件选择框(<input type="file"/>)的实现方法
- Mybatis的<where><foreach><set>等标签详解
- Struts 1 之<bean>标签库
- struts <s:action>标签的用法
- struts学习笔记 [JSTL]<c:forEach>标签的使用
- JSP web.xml <jsp-config>标签使用详解
- <a>标签 后台用struts1的action响应 action执行两次?
- Struts 1.x | <logic> 标签库