20031231 Wednesday December 31, 2003

Useless Tag Library? Inspired by this post, I wrote a tag library to expose the fields of my Contants.java class to my JSPs. It allows a user to specify a single variable using:

<appfuse:constants var="USER_KEY"/>

Or all variables:

<appfuse:constants/>

By default, it exposes the values from the Contants class imported into the tag library, but also allows a className variable to specify a different class. The main reason I wrote this was to prove it was possible. The second reason was to get around importing my Contants class (and using <%=Contants.VARNAME%>).

Interested? Read More ...

Posted in Java at Dec 31 2003, 08:25:57 AM MST 1 Comment

Comments:

Hi Matt, This tag is on my list of taglibs to write. I want to avoid using scriptlet as much as possible. Thanks for your work. Some suggestion to make it reusable: (1) make className required to get rid of appfuse Constants class dependency. (2) prefix the field name with class name to avoid name space collision resulting from multiple constants class files. (3) provide tld ct

Posted by c tang on January 02, 2004 at 02:04 PM MST #

Post a Comment:
Comments are closed for this entry.