-6ren">
gpt4 book ai didi

java - sitemesh 装饰器中的 Spring 安全标签

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:41:11 25 4
gpt4 key购买 nike

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

代码:

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

由于某些原因,两个 block 都没有显示。

最佳答案

我想您需要在过滤器链中的 Spring Security 过滤器之后放置 Sitemesh 过滤器,即订购它们的 <filter-mapping>web.xml相应地。

关于java - sitemesh 装饰器中的 Spring 安全标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4370629/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com