This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
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.
Jon [ December 05, 2004: Message edited by: Jon Entwistle ]
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.