File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Checking dynamically created multiboxes by default Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Checking dynamically created multiboxes by default" Watch "Checking dynamically created multiboxes by default" New topic
Author

Checking dynamically created multiboxes by default

Jon Entwistle
Ranch Hand

Joined: Feb 20, 2003
Posts: 118
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 ]

SCJD, SCEA
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

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.


Junilu - [How to Ask Questions] [How to Answer Questions]
Jon Entwistle
Ranch Hand

Joined: Feb 20, 2003
Posts: 118
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checking dynamically created multiboxes by default