No tag "datetimepicker" defined in tag library imported with prefix "s"解決

今天在學習Struts2標籤中的datetimepicker出現這樣一個exception:

No tag "datetimepicker" defined in tag library imported with prefix "s"

原因:

struts2.3.8 把struts2中的和ajax相關的,如datetimepicker,tree,treenode都移動到了dojo中了

解決方法:

1.將struts2-dojo-plugin-2.3.8.jar拷貝到/web-inf/lib下

2.jsp頁面文件加入"<%@taglib prefix="sx" uri="/struts-dojo-tags"%>"

3.在使用<s:datetimepicker>前添加<sx:head/>

4.<s:datetimepicker>換成<sx:datetimepicker>


<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>datetimepicker用法</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
  	<sx:head />
    <s:form>
    	出生日期:
    	<sx:datetimepicker name="mydate" toggleType="explode"
    		value="today" type="date" language="zh_CN" />
    </s:form>
  </body>
</html>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章