Results 1 to 3 of 3
  1. #1
    barbarabxl is offline Member
    Join Date
    May 2010
    Posts
    2
    Rep Power
    0

    Default JSF expression inside another JSF expression

    Hello
    I have a little problem. I have a list of maps List<Map<String,Waarde>>. For filling the maps I use a counter i, something like this:

    Java Code:
      Map m = new HashMap();   
      m.put("waarde"+[B]i[/B], Waarde);   
      list.add(m);
    To show the values on the screen I use a datatable, but to show the different objects Waarde in the maps, I need a counter in the name of the JSF expression, so a JSF expression inside another JSF expression, something like this:

    XML Code:
    <h:dataTable value="#{list}" var="_map">
       <a4j:repeat value="#{counter}" var="_i">
          <h:column>
             <h:outputText value="#{_map.waarde#{_i}.tekst}" />
          </h:column>
       </a4j:repeat>
    </h:dataTable>
    Has someone an idea how to deal with this?

    Thanks a lot!
    barbara
    Last edited by barbarabxl; 05-20-2010 at 05:09 PM.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    You don't need a counter to display values in the map.
    Just loop through all the elements using the method entrySet which gives you all the entries.
    You may need to create a getter style method in your backing bean so JSF can access it.

  3. #3
    barbarabxl is offline Member
    Join Date
    May 2010
    Posts
    2
    Rep Power
    0

    Default

    Thanks for your answer. I tried:

    Java Code:
    <h:dataTable value="#{waarden}" var="_map">
    
       <h:column>
          <h:outputText value="size #{_map.size}" />
       </h:column>
    
       <c:forEach items="#{_map.entrySet}" var="_mapje">
          <h:column>
             <h:outputText value="test #{_mapje.value.tekst}" />
          </h:column>
       </c:forEach>
    
    </h:dataTable>
    and the result was:

    size 5
    size 5
    size 5

    So there is a loop through the list with the 3 maps in it, but he doesn't loop through the maps.

Similar Threads

  1. regular expression
    By prof.deedee in forum JDBC
    Replies: 3
    Last Post: 02-19-2010, 11:15 AM
  2. Quadratic Expression
    By c3jcarmy in forum New To Java
    Replies: 7
    Last Post: 11-28-2009, 06:16 PM
  3. regular expression
    By ras_pari in forum Advanced Java
    Replies: 27
    Last Post: 10-07-2009, 12:25 PM
  4. Quick reg. expression help
    By RR_QQ in forum New To Java
    Replies: 4
    Last Post: 02-10-2009, 07:51 PM
  5. Boolean Expression
    By ritwik07 in forum New To Java
    Replies: 3
    Last Post: 07-11-2007, 04:11 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •