| Author |
EL equivalent of pageContext.getAttribute( aVariable )
|
Agoston Bejo
Greenhorn
Joined: Nov 23, 2007
Posts: 8
|
|
Hi! I have a variable the value of which is a key to look up a value the way pageContext.getAttribute() does (i.e. going through the page, request, session, application scopes in a row). So the main point is that the value of the lookup key can VARY, it's not constant. (Otherwise I could say ${LookupKey} and that would be it.) I.e. something like this: <c:set var="theKey" value="LookupKey"/> <c:if test="${pageContext[theKey]}"> ... the above syntax doesn't work, of course (otherwise my question would've been automatically answered ), it's just a pseudo-code for you to get the idea. Thanks! Agoston
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
I think I see what you're after... you want one level of indirection and you want all scopes to be automatically searched. I'm afraid you can't have both. For a scoped variable whose name is within another variable, you'll need to know what scope the variables is stored within and use syntax like:
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
|
P.S. I think that it's the PageContext.findAttribute() method you were referring to.
|
 |
Agoston Bejo
Greenhorn
Joined: Nov 23, 2007
Posts: 8
|
|
Yes, I was after that, and am sorry to hear that it's not possible. And yes, I meant PageContext.findAttribute().
|
 |
Agoston Bejo
Greenhorn
Joined: Nov 23, 2007
Posts: 8
|
|
And what I actually wanted to say was: thank you!
|
 |
 |
|
|
subject: EL equivalent of pageContext.getAttribute( aVariable )
|
|
|