J2EE: Default values for custom tag attributes

Posted by Nick on Stack Overflow See other posts from Stack Overflow or by Nick
Published on 2010-05-22T01:10:34Z Indexed on 2010/05/22 1:20 UTC
Read the original article Hit count: 272

Filed under:
|
|
|

So according to Sun's J2EE documentation (http://docs.sun.com/app/docs/doc/819-3669/bnani?l=en&a=view), "If a tag attribute is not required, a tag handler should provide a default value."

My question is how in the hell do I define a default value as per the documentation's description. Here's the code:

<%@ attribute name="visible" required="false" type="java.lang.Boolean" %>
<c:if test="${visible}">
     My Tag Contents Here
</c:if>

Obviously, this tag won't compile because it's lacking the tag directive and the core library import. My point is that I want the "visible" property to default to TRUE. The "tag attribute is not required," so the "tag handler should provide a default value." I want to provide a default value, so what am I missing?

Any help is greatly appreciated.

© Stack Overflow or respective owner

Related posts about j2ee

Related posts about java