I've just started using the taglib "unstandard" in the Jakarta Sandbox
which has a JSP tag that does exactly what you want. Say you have a
class called org.myorg.Constants, this tag creates an associative
array of the members like so:
<%@ taglib uri="http://jakarta.apache.org/taglibs/unstandard-1.0"; prefix="un"%>
<un:useConstants var="Constants" className="org.myorg.Constants"/>
<c:out value="My constant value: ${Constants.FOO}"/>

HTH,
-ed

On 1/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
>
> In my action classes, and other java classes, I use defined constants for my 
> Strings.  This is a common best practice.
>
> One frequent location of this practice is the names for the attributes I set 
> on the session and request ojbects.  Most of the time, I then access these 
> attributes on my JSP pages via various struts and jstl tags.  But when I 
> reference these objects from the JSP side, I find that I can't use defined 
> constants.  This undermines like 50% of the benefit of using defined 
> constants for my attribute names.
>
> Since the strust platform seems to demonstrate best practices most of the 
> time, I find it hard to believe that there isn't some what to use defined 
> constants in the JSP side.  I guess that isn't strut's realm, strictly 
> speaking.  It seems that if the JSP is really just a servlet, then surely I 
> can use the defined constants just as I do from java code.  But I don't know 
> how to do this.  Anybody know how?
>
> _______________________________________________
> Join Excite! - http://www.excite.com
> The most personalized portal on the Web!
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
    "The greatest tyrannies are always perpetrated in the name of the
noblest causes." Thomas Paine
    "Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety" - Benjamin
Franklin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to