strust2+No+tag+"datetimepicker"+defined+解决方法

 环境:Struts2.1.6+spring+hibernate

错误提示:org.apache.jasper.JasperException: /struts2/index.jsp(16,3) No tag "datetimepicker" defined in tag library imported with prefix "s"

原因:struts2.1.6 把struts2.0中的和ajax相关的,如datetimepicker,tree,treenode 都移动到了dojo中了

解决方法:
1、在jsp文件中加入<%@ taglib uri="/struts-dojo-tags" prefix="sx"%>和<sx:head/>

2、将<s:datetimepicker label="XXXX" name="XXXX"></s:datetimepicker>改为<sx:datetimepicker label="XXXX" name="XXXX"></sx:datetimepicker>

3、将struts2-dojo-plugin-2.1.6.jar拷贝到/web-inf/lib下

 

来自:http://teng2yue.iteye.com/blog/365337

 

struts2.0的日期控件<s:datetimepicker>

 

<s:datetimepicker label="日历" name="beginTime" value=""

 

                                     toggleType="plain" toggleDuration="300" language="us_en" type="date"

 

                                     displayWeeks="5" displayFormat="yyyy-MM-dd" formatLength="long" 

 

                                     id="btime"

                                     />

 来自:http://coder-vince.iteye.com/blog/1101868

 

使用时,要在<head/>里加上<s:head theme="ajax"/>,如:

<head>

<title>新闻列表</title>

<s:head theme="ajax"/>

</head>

 

 ---------------------------------------------------------------------------------------------------------------------------------------------------

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%> 
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<sx:head/>
</head>
<body>
  <s:form theme="simple">  
      日期选择部件,指定toggleType属性,且指定value="today"<br>  
      <sx:datetimepicker name="order.date" label="购买日期"

toggleType="explode" value="today"/><hr>  
      日期选择部件,指定了format属性<br>  
      <sx:datetimepicker name="order.date" label="购买日期"

displayFormat="yyyy年MM月dd日"/><hr>  
      日期选择部件,指定了weekStartsOn属性<br>  
      <sx:datetimepicker name="order.date" label="购买日期"

displayFormat="yyyy年MM月dd日" weekStartsOn="2"/><hr>  
      时间选择部件<br>  
      <sx:datetimepicker label="开始时间" name="start" type="time"

value="13:00" language="en-us"/>  
</s:form>  

</body>
</html>

 


 默认值:vaule String 日期,时间值.2.1.6 today已经取消(value="%{new java.util.Date()}")

FROM:http://www.iteye.com/problems/20544

你可能感兴趣的:(html,Ajax,struts,tree,dojo,library)