Spring security tags in sitemesh decorator

陌路散爱 提交于 2019-11-30 08:37:29

问题


I want to use a few tags of the spring security tag library inside the decorator file of site-mesh. However content inside these tags is never shown. Can anyone tell me why this is?

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

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

<html xmlns="http://www.w3.org/1999/xhtml">
<!--HTML-->
     <form id="login_form" method="post" action="<c:url value='j_spring_security_check'/>">
      <sec:authorize access="isAuthenticated()">
       <p>profile</p>
       <p>messages</p>
      </sec:authorize>
      <sec:authorize access="isAnonymous()">

       <!--A Login form -->
      </sec:authorize>
     </form>
<!--More HTML -->
</html>

Both block are not shown for some reason.


回答1:


I guess you need to place Sitemesh filter after the Spring Security filter in the filter chain, that is order their <filter-mapping>s in web.xml accordingly.



来源:https://stackoverflow.com/questions/4370629/spring-security-tags-in-sitemesh-decorator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!