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>
?