zoukankan      html  css  js  c++  java
  • 在Strust2 使用datatimepicker 标签引发的一系列问题

    问题:出现无法识别的问题

    原因:Strust2.1开始,对于ajax类的标签不再使用<%@ taglib prefix="s" uri="/struts-tags"%> 引用

    而是<%@ taglib prefix="sd" uri="/struts-dojo-tags"%>  

    解决方法:WEB-INF/lib下面添加struts2-dojo-plugin.jar包;,然后像类似这样的代码

    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>  
    <%@ taglib prefix="s" uri="/struts-tags"%>  
    <%@ taglib prefix="sx" uri="/struts-dojo-tags"%>  
    <html>  
    <head>  
    <sx:head />  
    </head>  
    <body>  
      
    <s:form method="post" theme="simple">  
        <sx:datetimepicker name="startDate" toggleType="explode"  
            toggleDuration="400" displayFormat="yyyy-MM-dd" id="start"  
            value="today" label="date">  
        </sx:datetimepicker>  
        <s:submit value="submit"></s:submit>  
      
    </s:form>  
      
    </body>  
    

     这个时候出现了新问题:

    运行报错:

    Unable to load configuration. - bean - jar:file:/E:/Program%20Files/apache-tomcat-8.0.3/webapps/web/WEB-INF/lib/struts2-dojo-plugin-2.3.16.1.jar!/struts-plugin.xml:29:136
     
    原因:
    struts2.3.16.xx版本把相关类进行了修改(改为 <bean type="org.apache.struts2.views.TagLibraryDirectiveProvider" name="sx" class="org.apache.struts2.dojo.views.DojoTagLibrary" /
     
     
    当你使用的Strust2-dojo-plugin.jar的版本过低,比喻Strust2 使用的是2.3.16.2,而你的Strust2-dojo-plugin是2.3.4时就会找不到类。
    Strust2-dojo-plugin 2.3.4 的Strust-plugin文件:
    <struts>
    <bean type="org.apache.struts2.views.TagLibrary" name="sx" class="org.apache.struts2.dojo.views.DojoTagLibrary"/>
    </struts>

    Strust2 2.3.16.1版本中已经改为

    办法就是使用一个跟你使用的Strust2版本相符的Strust2-dojo-plugin版本的jar

    下载地址

    http://repo1.maven.org/maven2/org/apache/struts/struts2-dojo-plugin/

  • 相关阅读:
    sql中保留2位小数
    C# 操作字符串,在某些特定的字符后面或前面添加其它字符
    Windows Server 2008 R2中上传和下载文件
    winform中显示标题,点击打开链接
    正则表达式
    winform重绘
    js获取元素的页面坐标
    剑指offer-从上往下打印二叉树
    剑指offer-栈的压入、弹出序列
    剑指offer-包含min函数的栈
  • 原文地址:https://www.cnblogs.com/nova-/p/3803321.html
Copyright © 2011-2022 走看看