Spring Security,JSP标记库错误

我想在我的JSP文件中包含spring security标签(意思是在JSP taglib scriptlet中),所以我在JSP中添加了以下行taglib prefix =“security”uri =“http://www.springframework.org/security/tags “(在JSP标签库中)

但我得到以下错误home.jsp:2:5:没有标签库可以找到这个URI。 可能的原因可能是URI不正确,或者在解析.tld文件时出现错误。

<dependency>
    <groupId>org.springframework.security</groupId>
     <artifactId>spring-security-web</artifactId>
     <version>3.0.5.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>
    <version>3.0.5.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-config</artifactId>
    <version>3.0.5.RELEASE</version>
</dependency>

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

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

为我工作,与这些

 <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring.security.version}</version>
            <scope>${defaultScope}</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring.security.version}</version>
            <scope>${defaultScope}</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring.security.version}</version>
            <scope>${defaultScope}</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${spring.security.version}</version>
            <scope>${defaultScope}</scope>
        </dependency>

spring.security.version = 3.1.4.RELEASE。

并确保你已经包括正确的JST罐子。


Gradle,添加到build.gradle

compile "org.springframework.security:spring-security-taglibs:$springSecurityVersion"

要么

compile "org.springframework.security:spring-security-taglibs:3.2.0.RELEASE"

或您的版本


我发现其他方式,这不是一个好方法,但它是如何为我工作,我已经将所有.class复制到/ WEB-INF /类,并将.tld文件复制到/ WEB-INF中,当我部署我使用的项目<%@ taglib prefix =“sec”uri =“http://www.springframework.org/security/tags”%但是在部署项目之后,我将taglib元素更改为@ taglib prefix =“sec “uri =”/ WEB-INF / security.tld“,并且使用了spring security标签,它工作正常我知道这不是一个好方法,但是我想学习spring,所以它对我有用:)

链接地址: http://www.djcxy.com/p/74671.html

上一篇: Spring Security, JSP Tag Lib Error

下一篇: Can not find the tag library descriptor for http://java.sun.com/jsf/facelets