struts2 datetimepicker标签的使用

http://blog.knowsky.com/194321.htm

struts2中引入了时间标签,可以方便的自由选择时间

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<s:head theme="simple"/>
<!-- 上面这个head标签必须要加,至于设置哪种主题没有限制,根据自己开发的需要 -->
<!-- 当没有加的时候就没有显示,这是为什么?我学习的时候不懂,谁看到了帮我解释下 -->
<body>
<s:form action="datatime" method="post">
<s:datetimepicker value="today" name="time" label="时间选择器"></s:datetimepicker>
<s:submit></s:submit>
</s:form>
</body>
</html>

效果图:

上述的<s:datetimepicker>使用在struts2.0.11版本下的标签,而struts2还有一标签为<sx:datetimepicker/>这个标签在struts2.0.11里是没有的,在struts2.0.11更高的版本里才会有,但是要用此标签必须要导入struts2-dojo-plugin-2.1.8.1.jar架包,

并且在页面上还需加入 <%@ taglib prefix="sx" uri="/struts-dojo-tags" %>在head标签内加入<sx:head/>标签,例如

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<sx:head/>
</head>
<body>
选择时间:
<sx:datetimepicker adjustWeeks="true" displayFormat="MM/dd/yyyy" toggleType="explode" />
</body>
</html>

?


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值