Normally, you'd cache the map in a backing bean. Make the scope of
the bean equal of the wanted scope of the map. Ie, if userController
is request-scoped, the map would be created once per request. If
your particular userController has a different scope than the map,
then create a rolesOfSelectedUser backing bean so you can control the
scope.
private Map rolesOfSelectedUserMap = null;
public Map getRolesOfSelectedUserMap()
{
if (null == rolesOfSelectedUserMap) { // create map }
return rolesOfSelectedUserMap ;
}
On 3/28/07, r.stranders <[EMAIL PROTECTED]> wrote:
Hi,
I ran into the following problem. I've got a map with some information I
would like to use in my page. Creating this map is an expensive operation
that should only be performed once. Therefore, I thought I could use the
<c:set> jstl tag. However, each time I access the variable, the method is
called again. In the example below for instance, the method
"rolesOfSelectedUserMap" is called twice.
<c:set var="rolesOfUser"
value="#{userController.rolesOfSelectedUserMap}" />
<h:outputText value="rolesOfUser['admin']" />
<h:outputText value="rolesOfUser['user']" />
It seems that <c:set> only creates an alias for the operation, and does not
actually set the variable "rolesOfUser" to the correct value. Any ideas how
to fix this (with or without c;set)?
--
View this message in context:
http://www.nabble.com/c%3Aset-creates-alias--tf3479258.html#a9710152
Sent from the MyFaces - Users mailing list archive at Nabble.com.