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>
</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/>标签,例如
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-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>
<sx:datetimepicker language="UTF-8"
不过也不影响,至于怎么去掉乱码然后不变成数字的显示样式目前不清楚怎么解决!