struts2中用DOJO时间控件dropdowndatepicker
来源:互联网 发布:飞鱼网络电视直播 编辑:程序博客网 时间:2024/05/22 03:31
在struts2中集成了对dojo的支持,这里以一个比较常用的日期标签来说明它的使用:
1。把struts2的jar包放入到工程中。
2。在页面头部加入:
<script type="text/javascript">
// Dojo configuration
djConfig = {
baseRelativePath: "struts/dojo",
isDebug: false,
bindEncoding: "UTF-8",
debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes
};
</script>
<script type="text/javascript" src="struts/dojo/dojo.js"></script>
<script type="text/javascript" src="struts/simple/dojoRequire.js"></script>
3。在需要日期标签的地方加入如下代码:
<div dojoType="dropdowndatepicker" inputName="startDate" dateFormat="%Y年%m月%d日"
value="${startDate}" containerToggle="explode" saveFormat="rfc">
</div>
其中的属性dojoType指明widget的类型(全部小写就可以了)。inputName就是生成的input字段的name,提交时候作为表单的一个 参数。dateFormat是日期的格式。weekStartsOn是日历中显示的一周以哪一天开始,这里是以周一开始(0-6,0代表周日)。 adjustWeeks指明是否需要根据每个月的实际天数来调整日历中每月显示的天数(如果不调整,每个月除了自己的天数,还会多出一些相邻月份的天数, 总的天数固定为42天)。如果需要给日期设置一个初始值,可以添加value属性,例如value="2006-10-25"。
下面看完整的例子:
- <%@ page contentType="text/html; charset=GBK"%>
- <%@ taglib uri="/WEB-INF/struts-bsst.tld" prefix="bsst"%>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
- <html>
- <head>
- <script type="text/javascript">
- // Dojo configuration
- djConfig = {
- baseRelativePath: "struts/dojo",
- isDebug: false,
- bindEncoding: "UTF-8",
- debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes
- };
- </script>
- <!-- 引入dojo包 -->
- <script type="text/javascript" src="struts/dojo/dojo.js"></script>
- <script type="text/javascript" src="struts/simple/dojoRequire.js"></script>
- </head>
- <body>
- <form action="" method="post" name="form1" >
- <tr class="MultiColor2">
- <td align="right">起始时间:</td>
- <td colspan="2">
- <div dojoType="dropdowndatepicker" inputName="startDate" dateFormat="%Y年%m月%d日"
- value="${startDate}" containerToggle="explode" saveFormat="rfc"></div>
- <span class="alert"> *</span>
- </td>
- </tr>
- <tr class="MultiColor1">
- <td align="right">截至时间:</td>
- <td colspan="2">
- <div dojoType="dropdowndatepicker" inputName="endDate" dateFormat="%Y年%m月%d日"
- value="${endDate}" containerToggle="explode" saveFormat="rfc"></div>
- <span class="alert"> *</span>
- </td>
- </tr>
- </table>
- <iframe id="resultFrame" name="resultFrame" style="display:none;"></iframe>
- </body>
- </html>
- struts2中用DOJO时间控件dropdowndatepicker
- struts2-dojo-plugin时间控件乱码解决
- DOJO学习笔记(七)-日期控件DropdownDatePicker和DatePicker
- DOJO学习笔记(七)-日期控件DropdownDatePicker和DatePicker
- 日期控件DropdownDatePicker和DatePicker
- struts2+dojo
- 关于在struts2中用ognl表达式截取时间长度
- struts2中用ajax标签出错。。一使用<s:head theme="ajax"/>就报错或者标签的时间控件显示不出来
- Struts2 集成 Dojo
- struts2标签dojo
- 有关struts2日历控件的小问题,struts-dojo-tags not found
- Dojo中的LazyTreeGrid控件
- struts2中的dojo插件使用
- struts2 dojo tree使用问题
- struts2 dojo 实现动态树
- struts2中用ajax问题
- Dojo Charting 控件高级用法
- struts2 dojo plugin的配置问题
- 个人站点提高访问量谋略
- 广告公司运营互联网项目分析
- 无任何框架下的Ajax应用Demo
- dbutils
- 让网站获得高流量和关注度
- struts2中用DOJO时间控件dropdowndatepicker
- 关于ip_conntrack: table full, dropping packet的问题
- 谈谈电子邮件营销步骤
- 网站设计的思考-版面布局的原理
- 《深入解析Oracle》一书前言
- 平面设计表现手法常识
- ip_conntrack: table full, dropping packet(from rackerhacker)
- 网站的资源整合是网站运营的核心
- DWR的同步和异步使用方式