I am doing a for each in JSTL on a collection(List).
How do I add something to to the object dynamically? Say I have a trait attribute and need to add maybe 2 or 6 to my hybrid object? So I would have a List of traits on my Hybrid. Can I do nested forEach like
Originally posted by Bosun Bello: you can not use it to update.
Sure you can. That's what <c:set> is for.
But... I'm very confused by the original question. You state that you want to "add" something, then give an example regarding nested looping. So I really have no idea what it is you are trying to accomplish.
If what you are asking is: how to loop on a nested collection (in other words, if traits is a collection that is a property of hybrid) then something like the following would suffice:
If your questions is something other than that, you're going to need to make what you are trying to do a bit clearer.