File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes tag attribute declarations:  defaultValue ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "tag attribute declarations:  defaultValue ?" Watch "tag attribute declarations:  defaultValue ?" New topic

tag attribute declarations: defaultValue ?

Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
I wish.

Seems like there should be a way to specify the default value for non-required attributes within the tag attribute declaration.

I know only this way:

It is kind of cumbersome.

It would be clearer (easier to read and maintain) to use this hypothetical syntax:

comp.lang.javascript FAQ:
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60050

Such a construct could not generally work. It could only be applied to extremely simple cases, such as your example. What would you specify if the attribute is a Map, or a List, or some custom bean (such as Person or SomeOtherComplexClass)?

Even in your simple case, is the attribute a boolean or the string "false"?
[ December 12, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
It is sorta covered in the JavaRanch Style Guide.
subject: tag attribute declarations: defaultValue ?
Similar Threads
EL + Custom Tag troubles
Recreating c:out
How can I consolidate some duplicate JSTL code in my JSP?
How to pass attribute to a custom tag only if it evaluates to a non null value