Reputation: 459
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.
Upvotes: 0
Views: 2779
Reputation: 1
Check what is mentioned in pom.xml and also reload project and make Maven clean and install this usually resolve the problem
...
<packaging>war</packaging>
...
<dependencies>
...
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.4.1</version>
</dependency>
enter code here
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>5.4.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
</plugin>
</plugins>
</build>
....
Upvotes: 0
Reputation: 53
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
Upvotes: 0
Reputation: 2922
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.
Upvotes: 0