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/

  • 相关阅读:
    P5356 [Ynoi2017]由乃打扑克
    P4921 [MtOI2018]情侣?给我烧了!/P4931 [MtOI2018]情侣?给我烧了!(加强版)
    P2605 [ZJOI2010]基站选址
    CF1062E Company
    kd-tree
    扩展中国剩余定理(EXCRT)
    CF264C Choosing Balls
    CF1139D Steps to One
    P4655 [CEOI2017]Building Bridges
    P3311 [SDOI2014] 数数
  • 原文地址:https://www.cnblogs.com/nova-/p/3803321.html
Copyright © 2011-2022 走看看