myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volker Weber" <weber.vol...@googlemail.com>
Subject Re: HashMap and dataTable
Date Fri, 19 Jan 2007 11:10:31 GMT
Hi,

try:

<t:dataTable value="#{myHashMap.myhmEntrySet}" var="entry">
  <t:column>
    <t:outputText value="#{entry.key}" />
  </t:column>
  <t:column>
    <t:outputText value="#{entry.value}" />
  </t:column>
</t:dataTable>

Regards,
  Volker

2007/1/19, mathias °ö° <Mathias.List@statistik.sachsen.de>:
>
> hi maik
> thanks for your answer
>
> it works, but the jsf-page display this:
>
> table:
> [Frage1=Antwort1, Frage3=Antwort3, Frage2=Antwort2, Frage4=Antwort4]
> [Frage1=Antwort1, Frage3=Antwort3, Frage2=Antwort2, Frage4=Antwort4]
> [Frage1=Antwort1, Frage3=Antwort3, Frage2=Antwort2, Frage4=Antwort4]
> [Frage1=Antwort1, Frage3=Antwort3, Frage2=Antwort2, Frage4=Antwort4]
>
> my jsf-page:
> <t:outputText value="table:" />
> <t:dataTable value="#{myHashMap.myhmEntrySet}" var="entry">
> <t:column>
> <t:outputText value="#{myHashMap.myhmEntrySet}" />
> </t:column>
> </t:dataTable>
>
> what is wrong?
>
>
> Mike Kienenberger wrote:
> >
> > UIData components operate on ordered lists.
> >
> > So the easiest thing to do would be to use something like this:
> >
> > <t:dataTable value="#{myHashMap.myhmEntrySetList}" var="entry">
> >
> > public List getMyhmEntrySetList() {
> >     return new java.util.ArrayList(myhm.entrySet());
> > }
> >
> >
> > On 1/18/07, mathias °ö° <Mathias.List@...> wrote:
> >>
> >> hi all
> >>
> >> how can i access my HashMap (backing bean) in the jsf-page:
> >>
> >> <t:dataTable value="#{myHashMap.myhm}" var="table">
> >> <t:column value=""></t:column> <!-- Frage column -->
> >> <t:column value=""></t:column> <!-- Antwort column -->
> >> </t:dataTable>
> >>
> >> backing bean:
> >>
> >> public class MyHashMap {
> >>
> >> public HashMap <String, String> myhm = new HashMap<String, String>();
> >>
> >> public HashMap<String, String> getMyhm() {
> >>
> >> myhm.put("Frage1", "Antwort1");
> >> myhm.put("Frage2", "Antwort2");
> >> myhm.put("Frage3", "Antwort3");
> >> myhm.put("Frage4", "Antwort4");
> >>
> >> return myhm;
> >>
> >> }
> >>
> >> public void setMyhm(HashMap<String, String> myhm) {
> >> this.myhm = myhm;
> >>
> >> }
> >>
> >> }
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/HashMap-and-dataTable-tf3033822.html#a8429583
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/HashMap-and-dataTable-tf3033822.html#a8446082
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>
Mime
View raw message