简体   繁体   中英

After adding “spring-security-taglibs” Still getting error in jsp: Can not find the tag library descriptor for spring security tag

Initially I was getting error in my jsp after adding the taglib " http://www.springframework.org/security/tags ", then I googled and found that spring-security-taglibs jar was missing, then I have added the jar/dependency in pom.xml file. But still I'm getting the same error. Any Idea what is happening.

jsp code,

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#" style="margin-bottom: 12px"> <img src="${pageContext.servletContext.contextPath}/resources/images/bluestar-logo.jpg" class="img-responsive" alt="Cinque Terre"></a>
          <div style="margin-left:700px">
            <h3>Decision Support System for VRF</h3>
        </div> 
        </div>

        <!-- <security:authorize ifAnyGranted="ROLE_USER"> -->
            <div id="navbar" class="navbar-collapse collapse">
              <ul class="nav navbar-nav navbar-right">
                <li><a href="#"><span class="glyphicon glyphicon-log-out" style="color:#fff"></span></a></li>
              </ul>
            </div>
        <!-- </security:authorize> -->

      </div>
    </nav>

In jsp On this line I am getting error <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> Any help will be greatly appreciated.

This question has been answered before I suppose, below is the solution from Spring Security, JSP Tag Lib Error

<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
works for me, with these

 <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>
where spring.security.version = 3.1.4.RELEASE.

And make sure you have included the correct jst jar.

For Spring MVC, i fixed it by adding

spring-security-taglibs.jar

file into the lib folder. Make sure that you use the same version with the other security jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM