最初我在添加taglib" http://www.springframework.org/security/tags"后我的jsp中出现错误,然后我用Google搜索并发现 spring-security-taglibs jar丢失了,然后我在pom.xml文件中添加了jar / dependency。但我仍然得到同样的错误。任何想法发生了什么。
jsp代码,
<%@ 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>
在jsp中这一行我收到错误&lt;%@ taglib prefix =&#34; security&#34; URI =&#34; HTTP://www.springframework.org/security/tags" %GT; 任何帮助将不胜感激。
答案 0 :(得分:0)
在我想之前,这个问题已得到解答,下面是解决方案 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.
答案 1 :(得分:0)
对于Spring MVC,我通过添加
来修复它弹簧安全taglibs.jar
文件到 lib 文件夹中。确保您使用与其他安全jar
相同的版本