You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kalcevich, Daniel" <dk...@firstam.com> on 2006/03/16 23:25:53 UTC
[OT] JSTL question
I am trying to access a session object where the key is the field
"ACCOUNT_PROFILE_SESSION_ATTRIBUTE" in a Constants JAVA file called
"GlobalConstants". I created a wrapper around it that extends Map
(JSTLConstants) to contain all the constants so I could access it via
JSTL. I am trying to do the following:
<jsp:useBean id="GlobalConstants" class="com.JSTLConstants"/>
<c:set var="accountProfile"
value="${GlobalConstants.ACCOUNT_PROFILE_SESSION_ATTRIBUTE}"
scope="page"/>
<c:out value="${sessionScope[accountProfile].accountName}"/>
My question is, how can I use the
GlobalConstants.ACCOUNT_PROFILE_SESSION_ATTRIBUTE value to lookup my
object in the Session using JSTL?
Dan
RE: [OT] JSTL question
Posted by Ruben Cepeda <ru...@hotmail.com>.
Daniel,
I often can across this problem in my development and found that a possible
solution is to use the
runtime-based version of the JSTL.
<%@ taglib prefix="c_rt" uri="http://java.sun.com/jstl/core_rt" %>
<c_rt:out value="<%= GlobalConstants.ACCOUNT_PROFILE_SESSION_ATTRIBUTE %>"/>
It does involve scriplet but which is it's main down fall. Hope it helps
*************************************
Ruben Cepeda
ruben_cepeda@hotmail.com
*************************************
----Original Message Follows----
From: "Kalcevich, Daniel" <dk...@firstam.com>
Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Subject: [OT] JSTL question
Date: Thu, 16 Mar 2006 14:25:53 -0800
I am trying to access a session object where the key is the field
"ACCOUNT_PROFILE_SESSION_ATTRIBUTE" in a Constants JAVA file called
"GlobalConstants". I created a wrapper around it that extends Map
(JSTLConstants) to contain all the constants so I could access it via
JSTL. I am trying to do the following:
<jsp:useBean id="GlobalConstants" class="com.JSTLConstants"/>
<c:set var="accountProfile"
value="${GlobalConstants.ACCOUNT_PROFILE_SESSION_ATTRIBUTE}"
scope="page"/>
<c:out value="${sessionScope[accountProfile].accountName}"/>
My question is, how can I use the
GlobalConstants.ACCOUNT_PROFILE_SESSION_ATTRIBUTE value to lookup my
object in the Session using JSTL?
Dan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org