<ui:repeat> is not a UIData, so you can't use the DataModel stuff.
Use request parameters instead.
That's strange to hear, because I've used it before, instead of a <h:dataTable> and it *does* work...
OK, Jacob says that <ui:repeat> _is_ aware of DataModels, even though it is not a UIData.
Well, I'm not sure, it should in priniple work. Try debugging.
You are welcome to submit a VERY SIMPLE test case to JIRA.
Well, if it's aware of DataModels, my initial question remains valid, how do I handle multiple (variable number of) DataModels? Or do I still have to use request parameters?
My initial question was not if it works.
It was this: the elements of my "main" DataModel have a OneToMany association (eg. Department -* Employee). How do I handle the employees as DataModels too? to have actions for them on the same page.. thanks.
You can put @DataMode on a method, if you like.
Like, which method? Do you mean annotating the @OneToMany relationship Department.employees with @DataModel in the Department entity bean?
Add a getEmployees() method, or something.
I have a test case at http://www.jboss.com/index.html?module=bb&op=viewtopic&t=86726&postdays=0&postorder=asc&start=10#3961165 . It has one <ui:repeat> nested inside another. The outer one is generated by a @Factory method in a stateful session bean and the inner one by a method in an entity bean. The two kinds of entity beans are related by @ManyToMany. If nobody sees a problem with it then I'll submit it to JIRA.
Unless you are sure there is a bug in Seam, and you know the nature of the bug, you should not create any JIRA issues. Nothing in this thread indicates you have found any kind of bug.
In the other topic I wrote:
When pressing the "rename" buttons, the value that I expect to be injected is not there (the log.error() calls below are triggered).
for instance (and yes, sorry for not including it in the previous post):
2006-07-27 10:51:56,946 DEBUG [org.jboss.seam.Component] selected row: null
2006-07-27 10:51:56,946 DEBUG [org.jboss.seam.Component] instantiating Seam component: interpolator
2006-07-27 10:51:56,946 ERROR [com.orgmob.play.FubarManagerBean] FubarManagerBean.commitFoo() called but foo is null!
2006-07-27 10:52:00,431 DEBUG [org.jboss.seam.Component] selected row: null
2006-07-27 10:52:00,431 DEBUG [org.jboss.seam.Component] instantiating Seam component: interpolator
2006-07-27 10:52:00,431 ERROR [com.orgmob.play.FubarManagerBean] FubarManagerBean.commitBar() called but bar is null!
When I press buttons that were generated using <ui:repeat> from a @DataModel, org.jboss.seam.Component says that no row was selected and where I expected @DataModelSelection to inject a value, the value is null. I think that is a bug. Am I in error?
I don't know the details of what works in facelets and what doesn't. You should ask about that in the facelets forum. But if it works when using h:dataTable, but not when using ui:repeat then it is definitely not a bug in Seam.
I think the original post is conceptually wrong. <ui:repeat> is an iterator. It can iterate over lists of things, including DataModels. However it doesn't modify the model that is iterates over. For example it will never set a DataModel's selected row and using @DataModelSelection with it will never work.
<ui:repeat> is a powerful substitue to using c:forEach. It is not a direct replacement for h:dataTable.
Maybe I misunderstand the original question. If you need @DataModelSelection to work, you'll need to go back to h:dataTable.
Note that there are plenty of other ways to implement clickable lists apart from @DataModelSelection. Arguably, using a request parameter (like in the blog example) is simply a better approach to begin with.