惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 【当耐特】
博客园 - 聂微东
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
F
Fortinet All Blogs
C
Check Point Blog
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - netshuai

免安装Oracle客户端使用PL/SQL连接Oracle的2种方法 优化MyEclipse7.5 WebService大讲堂之Axis2(9):编写Axis2模块(Module) WebService大讲堂之Axis2(10):使用soapmonitor模块监视soap请求与响应消息 WebService大讲堂之Axis2(7):将Spring的装配JavaBean发布成WebService WebService大讲堂之Axis2(8):异步调用WebService WebService大讲堂之Axis2(5):会话(Session)管理 WebService大讲堂之Axis2(6):跨服务会话(Session)管理 WebService大讲堂之Axis2(4):二进制文件传输 WebService大讲堂之Axis2(3):使用services.xml文件发布WebService WebService大讲堂之Axis2(2):复合类型数据的传递 (转)WebService大讲堂之Axis2(1):用POJO实现0配置的WebService J2EE项目代码编写规范 Dom4j入门 编码 GBK 的不可映射字符 ognl表达式用法笔记 - netshuai - 博客园 struts2中减少action数量(通配符使用) struts2校验框架之Visitor校验器 加快MyEclipse启动速度
struts2.1.6 datetimepicker标签不能使用的问题解决
netshuai · 2009-08-04 · via 博客园 - netshuai

在以前的struts2版本中datetimepicker只需要在head标签处设置
<s:head />,
就可以直接使用s:datetimepicker的标签了。
而在2.1.6版本中不能直接这样使用了,将datetimepicker移除了。
原因是此标签调用了dojo的datetimepicker的库。
所以现在使用的时候首先要导入一个库。

  • struts2-dojo-plugin-2.1.6.jar。


然后还要设置dojo的taglib

  1. <%@ taglib prefix="sd" uri="/struts-dojo-tags" %>   

同样也需要对theme进行设置

  1. <s:head theme="xhtml"/>   
  2. <sd:head parseContent="true"/>  

上面的设置在head标签中。
然后使用sd:datetimepocker就可以实现了。

设置formatLength为long的datetimepicker标签 value="today"默认显示当前日期,若想显示其他日期格式为value="%{'2009-1-1'}"

  1. <sd:datetimepicker toggleType="explode" value="today" formatLength="long" />  

设置displayFormat参数为“yyyy年MM月dd日”
displayWeeks参数为2的datetimepicker标签

  1. <sd:datetimepicker displayFormat="yyyy年MM月dd日" displayWeeks="2" />  

设置weekStartsOn参数为1,toggleType参数为fade的datetimepicker标签

  1. <sd:datetimepicker weekStartsOn="1" toggleType="fade" />  

设置显示时间datetimepicker标签

  1. <sd:datetimepicker type="time" value="8:30" />