struts2中日期标签的<sx:datatimepicker>的使用

今天用到了struts2的日期标签;整了一个下午没有整好.晚上回来上网查了一下。发现晚上这个问题不少但是都没有得到解决;算了 自己动手丰衣足食啊!

查看官方文档:

 

Description

To use the AJAX tags from 2.1 on you must:

  • Include the Dojo Plugin distributed with Struts 2 in your /WEB-INF/lib folder.
  • Add <%@ taglib prefix="sx" uri="/struts-dojo-tags" %> to your page.
  • Include the head tag on the page, which can be configured for performance or debugging purposes.

点击head连接:

 

Description

The "head" tag renders required JavaScript code to configure Dojo and is required in order to use any of the tags included in the Dojo plugin.

 

 

 

 

 

To debug javascript errors set the "debug" attribute to true, which will display Dojo (and Struts) warning and error messages at the bottom of the page. Core Dojo files are by default compressed, to improve loading time, which makes them very hard to read. To debug Dojo and Struts widgets, set the "compressed" attribute to true. Make sure to turn this option off before moving your project into production, as uncompressed files will take longer to download.

For troubleshooting javascript problems the following configuration is recommended:

  <sx:head debug="true" cache="false" compressed="false" />
 

 

 

这就是结果:

 

 

直奔主题:

我的 代码:

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sd" uri="/struts-dojo-tags"%>
<html>
<head>
 <sd:head debug="true" cache="false" compressed="false" />
</head>
<body>

<s:form method="post" theme="simple">
	<sd:datetimepicker name="startDate" toggleType="explode"
		toggleDuration="400" displayFormat="yyyy-MM-dd" id="start"
		value="today" label="date">
	</sd:datetimepicker>
	<s:submit value="submit"></s:submit>

</s:form>

</body>

 

 

后来试了一下 代码该为这样也可以:

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sd" uri="/struts-dojo-tags"%>
<html>
<head>
<sd:head />
</head>
<body>

<s:form method="post" theme="simple">
	<sd:datetimepicker name="startDate" toggleType="explode"
		toggleDuration="400" displayFormat="yyyy-MM-dd" id="start"
		value="today" label="date">
	</sd:datetimepicker>
	<s:submit value="submit"></s:submit>

</s:form>

</body>

 

确定在我的机器上可以运行并且出来结果: 我用的是eclipse 3.5

 

要在WEB-INF/lib下面添加struts2-dojo-plugin.2.1.8.1.jar包;

 

 

在这里我先说以下我也是刚接触struts2 我还不知道这是为什么? 希望那位大虾给指点指点。。。。。。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值