Question

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)

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top