Here's what I usually do:
request.setAttribute( Constants.USER, userObject ); and the Constants.java defines public final static String USER = "theUser"; then in the JSP <c:out value="${theUser.name}"/> But I want to be able to do something like <c:out value="${Constants.USER.name}"/> I've never actually tried this. Maybe I should before posting this, but I don't know why it would work. I thought the EL only had access to bean properties? So why would it be able to access a field directly? --- On Tue 01/24, Dave Newton < [EMAIL PROTECTED] > wrote: From: Dave Newton [mailto: [EMAIL PROTECTED] To: user@struts.apache.org Date: Tue, 24 Jan 2006 10:48:11 -0500 Subject: Re: constant strings in the tags [EMAIL PROTECTED] wrote:> 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. > Huh, don't know why you wouldn't be able to do that.Wait: you say you access the attributes on the JSP page but then say youcan't reference the objects on the JSP side.Are you saying that you do something like:request.setAttribute(foo.bar.attributeNames.BAZ, results) but in JSPyou're not able to do the same thing?> But I don't know how to do this. Anybody know how?> What, exactly, are you trying to do? You can access anything on a JSPpage by <%@ page import="..."%>-ing it. You can access things by puttingthem into scope. You can put strings into a resource file and accessthem from both JSP and code, and you get automagically I18Nized to boot.Dave---------------------------------------------------------------------To unsubscribe, e-mail: [EMAIL PROTECTED] additional commands, e-mail: [EMAIL PROTECTED] _______________________________________________ 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]