As far as I can tell: you  do not need ".value". You would need map[key].field if the entry associated with the key is an object of which you want to have the value of a field and not the object (e.g. a String) itself.
Besides: There is no need for a setter if all you are doing is to read from the map

Rick
Enrique Medina wrote:
Hi,

Yes I have both a getter for the map and a setter, which returns the whole map.

Let's put my example:

JSP EL _expression_ --> <t:dataTable value="#{puntuacionesBean.listasPuntuaciones['2'].value}"/>

Bean PuntuacionesBean -->

public Map getListasPuntuaciones()
{
    // Imagin something like...
    this.puntuacionesMap = new HashMap();

    this.puntuacionesMap.put(new Integer(2), //someValue);

    return puntuacionesMap;
}

public void setListasPuntuaciones(Map listasPuntuaciones)
{
    this.listasPuntuaciones = listasPuntuaciones;
}

If I debug the code, the value binding returns null when getting the value for the data table...


2005/11/2, Stefan Gesigora <[EMAIL PROTECTED]>:
Hi Enrique,

you always need a getter and a setter method for the map.
Then you can use it with the EL in this way:

<h:inputText binding="#{test1Bean.map['t3']}"/>

If you use a list:

<h:inputText binding="#{test1Bean.list[1]}"/>

regards,
Stefan


-----Ursprüngliche Nachricht-----
Von: Rick Gruber-Riemer [mailto:[EMAIL PROTECTED] ]
Gesendet: Mittwoch, 2. November 2005 12:04
An: MyFaces Discussion
Betreff: Re: EL & Maps

Hi

I definitively can confirm that Maps are supported - as I am using them
with MyFaces 1.1.1. Maybe you could elaborate a bit more ...

Rick

Enrique Medina wrote:
> Hi,
>
> I was trying to use an EL reference to a Map defined in my backing
> bean, but I always get null as a result.
>
> Doing some code reviewing I have seen that MyFaces uses the
> ELParserHelper class to invoke the Apache Commons library, but only
> gives support to arrays through its MyArraySuffix static inner class.
>
> Does this mean that no support for working with EL and maps in MyFaces
> is given? Am I missing something?




Reply via email to