繁体   English   中英

另一个定制标记中的JSP定制或JSTL标记

[英]JSP custom or JSTL tag inside another custom tag

我做了一个自定义标签,以验证某些用户会话状态。 但是, <c:url>在我的自定义标签正文中不起作用。 JSP:

<a href="<c:url value="/user/logout/"/>">Logout</a> <!-- THIS IS OK! -->
<bs:ifaccount logged="true">
   <--  THIS JUST FLUSHES <C:URL VALUE=... TO WEB BROWSER -->
   <a href="<c:url value="/user/logout/"/>">Logout</a> 
</bs:ifaccount>

标签声明:

<tag>
    <name>ifaccount</name>
    <tag-class>bs.tags.IfLoggedTagHandler</tag-class>
    <body-content>tagdependent</body-content>
    <attribute>
       <name>logged</name>
       <type>java.lang.Boolean</type>
       <required>true</required>
    </attribute>
</tag>

标签是通过SimpleTagSupport&getJspContent()。invoke(null)实现的

您的问题出在标签声明中:

<body-content>tagdependent</body-content>

您指定标签仅包含文本。 更改为:

<body-content>scriptless</body-content>

以便解析其他标签。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM