| Author |
scoped variable as attribute
|
Henrique Sousa
Ranch Hand
Joined: Apr 29, 2004
Posts: 92
|
|
Hi folks, Is it possible to use some scoped variable (or its properties) in attributes of JSF tags? I tried JSP expressions (${variable.property} or ${scope.var.prop}), but the compiler complained that I can't use expressions in attributes. So far, in order to do that kind of thing I obtain the needed object from a managed-bean property (therefore using #{managedBean.prop}). Is this the right way to do things? Thanks in advance
|
Henrique Sousa<br />SCJP 1.4<br /> <br />All men die, not all men really live - Braveheart, 1995
|
 |
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
|
|
Is it possible to use some scoped variable (or its properties) in attributes of JSF tags?
You certainly can, for e.g. through managed bean getters setters
Is this the right way to do things?
Can you explain what are you trying to do?
|
- Varun
|
 |
Henrique Sousa
Ranch Hand
Joined: Apr 29, 2004
Posts: 92
|
|
Sorry for the late reply, I was out for the weekend. Anyway, what I would like to achieve is something like this: where "someVariable" is a variable in request or session scope but not declared as a managed-bean. My first approach was to use JSP Expression Language (JSP 2.0 specs): but it didn't work because I can't use EL in attributes of JSF tags. Other naive approaches didn't work either: "#{someVariable}", "someVariable", ... The only way I did get it working was by setting the object to some managed-bean in the desired scope, as you suggested: Is this the only way to do this? [ June 13, 2005: Message edited by: Henrique Sousa ]
|
 |
 |
|
|
subject: scoped variable as attribute
|
|
|