Pure jsp solution:
provided that you have an array of available links: List<String> links
, which you pass under the same name for the request (or you can get it from the user, does not matter, suppose you have an array of these links, despite that you get this), then you can do something like:
... <c:forEach var="link" items="${links}"> <a href="${link}" <c:if test="/*here you test if user have access, i dont know how you do it*/"> class="inactiveLink" </c:if>>page link</a> </c:forEach> ...
Where ...
is the rest of your jsp and define a style
.inactiveLink { pointer-events: none; cursor: default; }
Note that to use foreach, you must define the jstl taglib at the top of jsp:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
If you do not know what jstl is and what EL is usually
It was said about disabling css and js, if you want them to be completely inaccessible, you can just print only allowed links:
... <c:forEach var="link" items="${links}"> <c:if test="/*here you test if user have access, i dont know how you do it*/"> <a href="${link}">page link</a> </c:if> </c:forEach> ...
source share