Enrique

 

Rick Gruber-Riemer wrote

I definitively can confirm that Maps are supported - as I am using them with MyFaces 1.1.1

 

So Your JSP code should be

 

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

which will invoke you bean code

 

public Map getListasPuntuaciones()

 

the value attribute (in t:dataTable) expects to be returned an object containing what will be your Rows of data

 

you ONLY need puntuacionesBean.listasPuntuaciones['2'] when you are trying to make your code invoke

Map.get(Key) – if you need to use this you must make sure that the ‘2’ value is compatible with you Key object type

 

Stefan Maric | IT & Professional Services | BT Global Services |

E: [EMAIL PROTECTED]  |  www.bt.com/globalservices

 

This electronic message contains information from British Telecommunications plc, which may be privileged

or confidential.  The information is intended for use only by the individual(s) or entity named above.  If you

are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of

this information is strictly prohibited.  If you have received this electronic message in error, please notify

me by telephone or email (to the number or email address above) immediately.

 

Activity and use of the British Telecommunications plc e-mail system is monitored to secure its effective

operation and for other lawful business purposes. Communications using this system will also be monitored

and may be recorded to secure effective operation and for other lawful business purposes.

 

British Telecommunications plc. Registered office:  81 Newgate Street London EC1A 7AJ   Registered in

England no:  1800000

size=2 width="100%" align=center tabindex=-1>

From: Rick Gruber-Riemer [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 02, 2005 12:48 PM
To: MyFaces Discussion
Subject: Re: EL & Maps

 

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