• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL Question

 
Tom Henricksen
Author
Ranch Hand
Posts: 144
5
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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



Thanks,
Tom
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe this can only be used to access/render information. And, you can not use it to update. I am sure someone will probably give a better explanation.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tom Henricksen
Author
Ranch Hand
Posts: 144
5
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is what I am trying to do Bear. I appreciate everyone's help. I apologize for being unclear.
Thanks,
Tom
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are going to be processing incoming parameters, and modifying your datastructures,


I think he made it clear in his last post that that's not what he's trying to do. He only wanted to nest the forEach loops and was confused as t o how to reference the nested element.
 
Stefan Evans
Bartender
Posts: 1780
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>I think he made it clear in his last post that that's not what he's trying to do
good point, my bad. (deleted post so as not to confuse anybody else)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic