Forums Register Login

Different parameters in c:forEach

+Pie Number of slices to send: Send
Hi! Is there any way I can have different parameters for objects in a c:forEach loop?
Example:

Any tips or idea to achieve this?
+Pie Number of slices to send: Send
 

Johan Rignas wrote:
Any tips or idea to achieve this?



Yes.

Don't do it.

JSTL and JSF do not play nice together. Don't use JSTL with JSF.

When you have multiple elements to display in a JSF view, use a dataTable if it organizes on the page as a 2-dimensional table (including single-column vertical list). Otherwise use the Facelets ui:repeat tag. In the case of a dataTable, you can include the "draggable" property value as a column in the table's DataModel. Which is the recommended way, since logic has no business being in the View template.
+Pie Number of slices to send: Send
Thanks for reply. I´m not sure I follow you. But I have now changed to a dataTable now looking like this:

And I would like to have it draggable iff my myElem is a specific value. Is possible to solve somehow?
1
+Pie Number of slices to send: Send
You can't have columns without rows. You need AT LEAST one row or the table won't render. A "value="" won't do what you want.

You could use EL to do what you want:


However, as I said, it's not a good idea to put logic in the View template. Aside from polluting MVC, it's a bugger to debug. Better is to handle it in the datamodel and simplify the EL:
+Pie Number of slices to send: Send
Dont manage to do the bean solution so I go for EL by the moment. It works great. Thanks!!!
I can't beleive you just said that. Now I need to calm down with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1020 times.
Similar Threads
multibox - nullPointerException
xsl processing question
ArrayList not displaying
JDK DOM question
html:link Dynamic data
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 23:52:24.