sitemesh 装饰器中的 Spring 安全标签 [英] Spring security tags in sitemesh decorator

查看:26
本文介绍了sitemesh 装饰器中的 Spring 安全标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在site-mesh的decorator文件中使用spring security标签库的几个标签.然而,这些标签内的内容永远不会显示.谁能告诉我这是为什么?

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?

代码:

<!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.

推荐答案

我猜你需要在过滤器链中的 Spring Security 过滤器之后放置 Sitemesh 过滤器,也就是为了它们的 web.xml 中的 code>s.

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.

这篇关于sitemesh 装饰器中的 Spring 安全标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆