简体   繁体   English

找不到springframework的标签库描述符

[英]Can not find the tag library descriptor of springframework

I'm trying to follow the example of spring JPetStore but I get an error in the JSP pages in the line that references the lib tag spring:我正在尝试遵循 spring JPetStore 的示例,但在引用 lib 标记 spring 的行中的 JSP 页面中出现错误:

Can not find the tag library descriptor for "http://www.springframework.org/tags"找不到“http://www.springframework.org/tags”的标签库描述符

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

What is the URL of this library?这个库的网址是什么?

Is there any way to avoid the direct dependence on this URL?有什么办法可以避免直接依赖这个URL吗?

Thanks in advance提前致谢

I know it's an old question, but the tag library http://www.springframework.org/tags is provided by spring-webmvc package.我知道这是一个老问题,但是标签库http://www.springframework.org/tags是由spring-webmvc包提供的。 With Maven it can be added to the project with the following lines to be added in the pom.xml使用 Maven 可以将其添加到项目中,并在pom.xml添加以下几行

<properties>
    <spring.version>3.0.6.RELEASE</spring.version>
</properties>

<dependencies>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

Without Maven, just add that jar to your classpath.如果没有 Maven,只需将该 jar 添加到您的类路径中。 In any case it's not necessary to refer the tld file directly, it will be automatically found.在任何情况下都不需要直接引用 tld 文件,它会自动找到。

  1. Download the Spring dependency jar下载 Spring 依赖 jar
  2. Place it to the lib folder path is /WEB-INF/lib/spring.jar把它放到lib文件夹路径是/WEB-INF/lib/spring.jar
  3. Then open the web.xml and the sample code is:然后打开web.xml,示例代码为:

     <taglib> <taglib-uri>/WEB-INF/spring.tld</taglib-uri> <taglib-location>/WEB-INF/spring.tld</taglib-location> </taglib>
  4. Then the taglib is indicated where the jar file locates in ur system.然后taglib被指示jar文件在你的系统中的位置。

     <%@ taglib prefix="spring" uri="/WEB-INF/spring.tld" %>

删除@taglib之间的空格对我来说很有效: <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

If you are using maven use this dependency:如果您使用 Maven,请使用此依赖项:

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-taglibs</artifactId>
    <version>3.1.4.RELEASE</version>
</dependency>

you have to add the dependency for springs mvc您必须为 springs mvc 添加依赖项

tray adding that in your pom托盘在你的 pom 中添加

<!-- mvc -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>3.1.2.RELEASE</version>
</dependency>

The TLD should be located in the spring.jar . TLD 应位于spring.jar Your application won't have any dependency on that URL.您的应用程序不会对该 URL 有任何依赖。 It's just used as a unique name to identify the tag library.它只是用作标识标签库的唯一名称。 They could just as well have made the URI "/spring-tags", but using URLs is pretty common place.他们也可以将 URI 设为“/spring-tags”,但使用 URL 是很常见的地方。

I had the same issue with weblogic 12c and maven I initially while deploying from eclipse (kepler) (deploying from the console gave no errors).我最初在从 eclipse (kepler) 部署时遇到了与 weblogic 12c 和 maven 相同的问题(从控制台部署没有错误)。

The other solutions given on this page didn't help.此页面上给出的其他解决方案没有帮助。

I extracted the spring.tld spring-form.tld files of the spring-webmvc jar (which I found in my repository) in the web\\WEB-INF folder of my war module;我在我的 war 模块的 web\\WEB-INF 文件夹中提取了 spring-webmvc jar(我在我的存储库中找到)的spring.tld spring-form.tld文件;

I did a fresh build;我做了一个新的构建; deployed (from eclipse) into weblogic 12c, tested the application and the error was gone;部署(从eclipse)到weblogic 12c,测试应用程序,错误消失;

I removed the spring.tld spring-form.tld files again and after deleting;我再次删除了spring.tld spring-form.tld文件,删除后; rebuilding and redeploying the application the error didn't show up again.重建和重新部署应用程序,错误没有再次出现。

I double checked whether the files were gone in the war and they were indeed not present.我仔细检查了这些文件是否在战争中消失了,它们确实不存在。

hope this helps others with a similar issue...希望这可以帮助其他有类似问题的人......

I finally configured RAD to build my Maven-based project, but was getting the following exception when I navigate to a page that uses the Spring taglib:我最终配置了 RAD 来构建我的基于 Maven 的项目,但是当我导航到使用 Spring taglib 的页面时遇到以下异常:

JSPG0047E: Unable to locate tag library for uri http://www.springframework.org/tags at com.ibm.ws.jsp.translator.visitor.tagfiledep.TagFileDependencyVisitor.visitCustomTagStart(TagFileDependencyVisitor.java:76) ... JSPG0047E: 无法在 com.ibm.ws.jsp.translator.visitor.tagfiledep.TagFileDependencyVisitor.visitCustomTagStart(TagFileDependencyVisitor.java:76) 上找到 uri http://www.springframework.org/tags 的标记库...

The way I had configured my EAR, all the jars were in the EAR, not in the WAR's WEB-INF/lib.按照我配置 EAR 的方式,所有 jar 都在 EAR 中,而不是在 WAR 的 WEB-INF/lib 中。 According to the JSP 2.0 spec, I believe tag libs are searched for in all subdirectories of WEB-INF, hence the issue.根据 JSP 2.0 规范,我相信在 WEB-INF 的所有子目录中搜索标签库,因此存在问题。 My solution was to copy the tld files and place under WEB-INF/lib or WEB-INF.. Then it worked.我的解决方案是复制 tld 文件并将其放在 WEB-INF/lib 或 WEB-INF 下。然后它起作用了。

If you want direct link:如果你想要直接链接:

https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/resources/META-INF/spring-form.tld https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/resources/META-INF/spring-form.tld

Or from repos:或从回购:

JCenter : link JCenter链接

Maven Central : link Maven 中心链接

And if you need as Gradle dependency:如果您需要 Gradle 依赖项:

compile 'org.springframework:spring-webmvc:4.1.6.RELEASE编译'org.springframework:spring-webmvc:4.1.6.RELEASE

More information about spring-form: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/spring-form.tld.html有关弹簧形式的更多信息: http : //docs.spring.io/spring/docs/current/spring-framework-reference/html/spring-form.tld.html

Here is another case.这是另一个案例。

We have several portlets in different portlet application war and all of them use spring.我们在不同的 portlet 应用程序战争中有几个 portlet,它们都使用 spring。 So in order to reduce size of each war, we have created shared libraries for spring jars in the WebSphere Portal server.因此,为了减少每次战争的规模,我们在 WebSphere Portal 服务器中为 spring jar 创建了共享库。

However, I came across the same issue as above of not having the spring form tags being referred from the jsp files.但是,我遇到了与上述相同的问题,即没有从 jsp 文件中引用 spring 表单标签。

In order to resolve, I have copied the spring-form.tld file into the WEB-INF/ directory and redeployed the war and it worked.为了解决,我已经将 spring-form.tld 文件复制到 WEB-INF/ 目录中,并重新部署了 war 并且它起作用了。

Hope it helps for anyone having a similar issue as mine.希望它对任何与我有类似问题的人有所帮助。

This problem normally appears while copy pasting the tag lib URL from the internet.此问题通常在从 Internet 复制粘贴标签库 URL 时出现。 Usually the quotes "" in which the URL http://www.springframework.org/tags is embedded might not be correct.通常,嵌入 URL http://www.springframework.org/tags的引号""可能不正确。 Try removing quotes and type them manually.尝试删除引号并手动键入它们。 This resolved the issue for me.这为我解决了这个问题。

I was using Spring-Boot, For me cut-paste of below in Pom.xml worked.我正在使用 Spring-Boot,对我来说在 Pom.xml 中剪切粘贴下面的工作。 May be file wasnt in sync.可能是文件不同步。

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
</dependency>

Core dependencies for tag library:标签库的核心依赖:

> <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
</dependency>
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
</dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>

add external jar of jstl-standard.jar as the external jar by right click on JRE system libraries under configure build path -> build path.通过在配置构建路径-> 构建路径下右键单击 JRE 系统库,将 jstl-standard.jar 的外部 jar 添加为外部 jar。 it worked for me!!它对我有用!!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到标记库描述符 - Can't find tag library descriptor 错误 - 找不到“/struts-tags”的标签库描述符 - Error - Can not find the tag library descriptor for “/struts-tags” eclipse : 找不到“/struts-tags”的标签库描述符 - eclipse : Can not find the tag library descriptor for “/struts-tags” 在jsp中找不到“/struts2-jquery-tags”的标签库描述符 - Can not find the tag library descriptor for “/struts2-jquery-tags” in jsp 找不到“http://java.sun.com/jsp/jstl/core”的标签库描述符 - Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core” JSP错误“找不到“ http://java.sun.com/jsp/jstl/core”的标记库描述符 - JSP error “Can not find the tag library descriptor for ”http://java.sun.com/jsp/jstl/core" 找不到“http://java.sun.com/jsp/jstl/core”的标签库描述符 - Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core” 添加“ spring-security-taglibs”后,在jsp中仍然出现错误:找不到spring安全标签的标签库描述符 - After adding “spring-security-taglibs” Still getting error in jsp: Can not find the tag library descriptor for spring security tag Eclipse“找不到自定义标签的标签库描述符”(不是JSTL!) - Eclipse “cannot find the tag library descriptor” for custom tags (not JSTL!) 在Maven Eclipse项目中找不到Spring框架的标签库描述符 - cannot find tag library descriptor for spring framework in maven eclipse project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM