2016-08-02 30 views
2
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> 
<html> 
<head> 
    <title>Sample Title</title> 
    <style type="text/css"> 
    body { 
     background-color: Lightgrey; 
    } 
    </style> 
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> 
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
</head> 
<body> 
<div class="container"> 
    <h1>Sample Page</h1><br> 
    <h3>Admin</h3> 
    <ul class="list-inline"> 
    <li><a href="http://localhost:8080/sample/tab1">Tab 1</a></li> 
    <li><a href="http://localhost:8080/sample/tab2">Tab 2</a></li> 
    <li><a href="http://localhost:8080/sample/tab3">Tab 3</a></li> 
    </ul> 

    **<c:set var="isAllowed" value="${false}" /> 
    <sec:authorize access="isAuthenticated()"> 
     <sec:authorize access="hasAuthority('PERMISSION_MANAGER')" var="isAllowed" /> 
    </sec:authorize>** 

    <c:if test="${isAllowed}"> 
     <h3>Manager</h3> 
     <ul class="list-inline"> 
     <li><a href="http://localhost:8080/sample/tab1/search">Search</a></li> 
     <li><a href="http://localhost:8080/sample/tab1/add">Add</a></li> 
     <li><a href="http://localhost:8080/sample/tab1/delete">Delete</a></li> 
     </ul> 
    </c:if> 
</div> 

</body> 
</html> 

警告在此代碼正在逐漸未知標籤warning.I已經在WEB-INF/lib目錄directory.Because包括JSTL的jar文件強調了代碼塊只顯示了這個warning.I找不到我的錯誤。請幫忙。未知標籤(C:如果)在JSP

JSTL核心&安全標籤庫包含在jsp文件的頂部。

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> 

並且在maven依賴中包含jstl jar。但是我仍然收到警告信息未知標籤在日食中的所有jstl標籤。有人可以幫助我避免在jsp頁面中出現所有jstl標籤的警告嗎?

感謝

更新:

 <properties> 
      <jstl.version>1.2</jstl.version> 
      <spring-security.version>4.0.3.RELEASE</spring-security.version> 
     <properties> 


     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>jstl</artifactId> 
      <version>${jstl.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-taglibs</artifactId> 
      <version>${spring-security.version}</version> 
     </dependency> 
+0

Post'pom.xml'依賴關係。 – tarashypka

+0

添加原始帖子的條目。 @tarashypka – Mohan

+1

因此,當你忽略Eclipse的警告並運行它時,它工作正常嗎?因此,這是一個Eclipse問題,而不是JSP/JSTL問題? – BalusC

回答

2

這似乎是Eclipse的問題。我嘗試重新啓動日食,但它沒有幫助。

最後,我只是忽略了Eclipse對「未知標記」的警告並重新啓用它。現在一切都很好。現在只顯示真實的警告。

Eclipse - > Windows - >首選項 - > Web - > HTML文件 - >驗證