Jsp 在jstl if语句中使用变量
我有类似的东西Jsp 在jstl if语句中使用变量,jsp,jstl,el,Jsp,Jstl,El,我有类似的东西 <c:forEach var="authority" items="#{SPRING_SECURITY_CONTEXT.authentication.principal.authorities}"> <c:if test="${fn:contains( ${authority} , ROLE_ADMIN) }"> </c:if> </c:forEach> 但它不工作,任何ide我如何才能做到这一点
<c:forEach var="authority" items="#{SPRING_SECURITY_CONTEXT.authentication.principal.authorities}">
<c:if test="${fn:contains( ${authority} , ROLE_ADMIN) }">
</c:if>
</c:forEach>
但它不工作,任何ide我如何才能做到这一点?也许还有别的办法
//在if测试中编辑了您缺少一个结束“)”:
<c:forEach var="authority" items="#{SPRING_SECURITY_CONTEXT.authentication.principal.authorities}">
<c:if test="${fn:contains( {$authority} , ROLE_ADMIN ) }">
</c:if>
</c:forEach>
您在if测试中缺少一个“结束”):
<c:forEach var="authority" items="#{SPRING_SECURITY_CONTEXT.authentication.principal.authorities}">
<c:if test="${fn:contains( {$authority} , ROLE_ADMIN ) }">
</c:if>
</c:forEach>
有两个问题:
<c:if test="${fn:contains(authority, ROLE_ADMIN)}">
<c:if test="${fn:contains(authority, ROLE_ADMIN)}">
这不是问题,只是打错了。这不是问题,只是打错了