Hello my friends,

 

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.

 

Thanks in advance.

 

Regards,

 

Josh Holtzman

American Data Company

[EMAIL PROTECTED]

Voice: (310) 470-1257

Fax:    (310) 362-8454

 

Sun Microsystems iForce Partner

 

Reply via email to