0
votes

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.

2
please share the error description - Saurabh Jhunjhunwala
<%@ taglib prefix="security" uri="springframework.org/security/tags" %> On this line I'm getting error as 'Can not find the tag library descriptor for "springframework.org/security/tags" ' - Sandeep Patange
Can your share your jsp code - Saurabh Jhunjhunwala
@SaurabhJhunjhunwala, I have added jsp code in question. - Sandeep Patange

2 Answers

0
votes

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.
0
votes

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