根据特定用户隐藏或显示JSP上的链接?

根据特定用户隐藏或显示JSP上的链接?,jsp,spring-security,Jsp,Spring Security,我的MVC应用程序的JSP主页上有一些链接。现在,我的目标是隐藏或显示指向某些特定用户的特定链接,我已经在applicationContext-security.xml中定义了这些链接,如下所示: <authentication-provider> <user-service id="userDetailsService"> <user name="admin" password="admin" authorities="RO

我的MVC应用程序的JSP主页上有一些链接。现在,我的目标是隐藏或显示指向某些特定用户的特定链接,我已经在applicationContext-security.xml中定义了这些链接,如下所示:

<authentication-provider>
        <user-service id="userDetailsService">
            <user name="admin" password="admin" authorities="ROLE_TEST, ROLE_USER, ROLE_SUPERVISOR, ROLE_ADMIN" />
            <user name="tom" password="kite" authorities="ROLE_SUPERVISOR, ROLE_TEST, ROLE_USER" />
            <user name="user" password="pass" authorities="ROLE_USER, ROLE_TEST" />
            <user name="test" password="test" authorities="ROLE_TEST" />
        </user-service>
    </authentication-provider>



谢谢你的帮助

Spring security有一个解决方案

<%@ include file="/WEB-INF/jsp/include.jsp" %>

<html>
  <head>
  <link rel="stylesheet" type="text/css" href="css/mystyle.css" />
  <title><fmt:message key="title"/></title>
  </head>
  <body>
    <h1><fmt:message key="heading"/></h1>
    <p><fmt:message key="greeting"/> <c:out value="${model.now}"/></p>
    <h3>Products</h3>
    <table border="2" align="center">
 <tr>
 <td align="center" width="50"><b><span style="color:red">Id</span></b></td>

 <td align="center" width="150"><b><span style="color:red">Product Name</span></b></td>

 <td align="center" width="150"><b><span style="color:red">Product Price</span></b></td>

 <td align="center" colspan="2" width="70"><b><span style="color:red">Actions</span></b></td>

 </tr>
    <c:forEach items="${model.products}" var="prod">
      <tr>
   <td align="center"><c:out value="${prod.id}"/></td>
   <td align="center"><c:out value="${prod.description}"/></td>
   <td align="center"><i>$<c:out value="${prod.price}"/></i></td>
   <td align="center" width="70"> <a href="<c:url value="/editpage.htm?id="/>${prod.id}&prodname=${prod.description}&prodprice=${prod.price}">Edit</a></td>
   <td align="center" width="70"><a href="<c:url value="/deleteprod.htm?id="/>${prod.id}&prodname=${prod.description}&prodprice=${prod.price}">Delete</a></td>
  </tr>
     </c:forEach>
     </table>
    <br>
    <ul><li><a href="<c:url value="/addprod.htm"/>">Add New Products</a></li></ul>
    <ul><li><a href="<c:url value="/priceincrease.htm"/>">Increase Prices</a></li></ul></br>
    <%@ include file="/WEB-INF/jsp/navigation.jsp" %>
    <%@ include file="/WEB-INF/jsp/userinfobar.jsp"%>
    <p>
  </body>
</html>