• Post Reply Bookmark Topic Watch Topic
  • New Topic

ui:repeat, c:foreach in JSF 2.0  RSS feed

 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know the difference of ui:repeat and c:forEach (http://www.ilikespam.com/blog/c:foreach-vs-ui:repeat-in-facelets).

However, I do not know, why ui:repeat does not view the datas of my list whereas c:forEach does:




when clicking the button, I update my "panel" via ajax. However, only "output_text" shows me, the list. Ui:repeat shows nothing after ajax update (I guess it does not iterate through the list). C:ForEach iterate through the list and shows me the listdata, but only when clicking the button twice! What is wrong?

I use JSF 2.0
 
Bartender
Posts: 18886
78
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From what I can see, you're better off forgetting the algorthmic stuff altogether. Just use a dataTable. It's a lot cleaner. JSF views aren't the place to put code, even when it's tag code.

Personally, I like RichFaces, where I can use the a4j:commandButton to do the request and set its reRender attribute to indicate what parts of the display to update. Nice and simple.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed, I can use h:datatable, but I want to know, why ui:repeat is not working. With JSF 1.2 it is working, with JSF 2.0 it is not working! Is there a bug?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I just run into quite a similar problem. Did you find a solution for this?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. It's an old post but google brought me here so I'll just point out that in the the 'var' and 'value' seem to be the wrong way around. 'value' is the attribute holding the collection to be iterated.
 
Tim Holloway
Bartender
Posts: 18886
78
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Rano!

You're correct. The convention is that "value" is the collection and "var" is the current value in the iteration of that collection. That's true for any JSF tag that itemizes a collection.

And "_l" was a bad choice of names by the original author, but that's another matter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!