2

ユーザー セッションの状態を確認するために、カスタム タグを作成しました。しかし、<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)で実装されています

4

1 に答える 1