• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Checking dynamically created multiboxes by default

 
Jon Entwistle
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am having a bit of a problem getting to grips with checking dynamically generated multiboxes by default, and any pointers would be very much appreciated.

I understand that in order to check a multibox option, the value of the multibox item should be inlcuded in the array of values for the multibox (this is explained quite nicely at http://husted.com/struts/tips/007.html).

In order to check a value by default as I understand it, the value could be added to the array in the Form's constructor.

My problem is that I am creating the multibox items on the fly, and so do not know the values to add to the array when I construct the Form bean. How can I get around this?

Again, any insight appreciated.

Regards,

Jon
[ December 05, 2004: Message edited by: Jon Entwistle ]
 
Junilu Lacar
Bartender
Pie
Posts: 7306
45
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't necessarily have to do the initialization in the constructor. You said that the multiboxes are created dynamically so I assume you are iterating through some kind of collection to do so. In that case, you would initialize the default values in your Action before you forward to the JSP that displays the multiboxes.
 
Jon Entwistle
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the tip. I followed your advice and created and initialised the form bean in the preceeding Action and added it to the scope needed, it all works fine.

Cheers,

Jon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic