문제

I have made a custom tag, to verify some user session state. But, <c:url> is not working in my custom tag body. 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 declaration:

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

Tag is implemented with SimpleTagSupport & getJspContent().invoke(null)

도움이 되었습니까?

해결책

Your problem is in your tag declaration:

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

You're specifiyng that your tag contains only text. Change it to:

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

to allow other tags to be parsed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top