Forums Register Login

iterate in jsf

+Pie Number of slices to send: Send
Hi,

I have to display the following fields in a tabular form as below

column1 | column2 | column3 | column4
[Text] [dropdown] [dropdown] [dropdown]
[Text] [dropdown] [dropdown] [dropdown]
[Text] [dropdown] [dropdown] [dropdown]
[Text] [dropdown] [dropdown] [dropdown]
...

In the backing bean, I have a List<SelectList> to cater to these dropdowns.
All these dropdowns have the same set of values.

I need a mechanism to iterate over a list in jsf.

I tried <h:datatable> and <c:foreach> but was getting error.


Error in logs
Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(selectIsRetrieved)
+Pie Number of slices to send: Send
JSF pages are declarative constructs, so it's bad practice to even try and put logic on them - as you can see, often it doesn't work at all.

Your second approach (nested JSF constructs) is correct, but your problem is in the model. Ideally, you could use your backend data as the page model, but in certain cases, that won't work and you need JSF-specific constructs. In your case, what that means is that the child lists for your table model must be lists (or arrays) of SelectItems, and not the actual data items themselves.

The error message you got is confusing and I've whined to someone from Sun about it, but I don't carry much clout with them, alas.
keep an eye out for scorpions and black widows. But the tiny ads are safe.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 15628 times.
Similar Threads
How to retreive (or Hold) these values from JSF page
Form calling a session scoped backing bean constructor twice
Navigation not working due due SelectOneMenu object
Unable to call Action Methof
rich:dropSupport not working
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 10:14:30.