The EL only references "scoped variables", not scriptlet variables.
Read the JSTL specification for a good summary of what you can do with
it.

If you have a small number of constants, then put your constants
directly into a scoped variable (application-scoped, most likely).  So,
if you define a scoped variable named "USER_KEY", you could do this:

<c:out value="${sessionScope[USER_KEY].account.userName}"/>

> -----Original Message-----
> From: Josh Holtzman [mailto:[EMAIL PROTECTED] 
> 
> I am currently accessing a value for output by using the following EL
> syntax:
> 
> <c:out value="${sessionScope.USER_CONTAINER.account.userName}" />
> 
> USER_CONTAINER is the key I use to store my UserContainer 
> object in the session.
> 
> I have created a global variable to identify the 
> USER_CONTAINER.  It can be accessed in a constant's class by 
> the static variable AppConstants.USER_KEY.
> 
> Is it possible using Struts-EL to replace the literal 
> USER_CONTAINER with the variable AppConstants.USER_KEY, so as 
> to write something like this:
> 
> <c:out value="${sessionScope.<%= 
> AppConstants.USER_KEY%>.account.userName}"
> />
> 
> This will not compile properly, so, either this is not 
> possible, or my syntax is incorrect.
> 
> Does anyone have any other suggestions?  
> 
> I'd rather use the constant to look up this value rather than 
> a literal.  In the event I need to change the name of the key 
> to look up this value in the session, I can then change it in 
> one place rather than all the JSP pages that make similar lookups.

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

Reply via email to