Thanks Adam. Yes, I have a bean lets say, Testbean with two Collections. I have to display the value of these Collections[has objects] in a select box in my JSP. Can you send me the sample code please ? Maya
Adam Gordon <[EMAIL PROTECTED]> wrote: > In my JSP I have a textbox and two list boxes[which can display > multiple values]. > > From my database, I have an object [a data object], ListData with > following information returning > string result; > Vector itemList; //list of object 1 > ArrayList itemList1; //list of object 2 > > In my JSP, I have th reference to ListData object, I know I can use > >> bean:write and get result. >> > > Now, for getting fields within the arraylists, is there any tag which > I can use ? > Yes and no, depending on your desired implementation. Probably the easiest way I've found is to use the LabelValueBean object and construct a java.util.List of these objects from your model data. Then, following the example at http://wiki.apache.org/struts/StrutsWidgets, you can use the html:optionsCollection element and the "value" and "label" attributes to retrieve the value and display name (two separate things) of the item selected in the listbox. Since I just implemented this late last week, I can post an example if you'd like...it's pretty straight forward once you grasp how to use it (although, it was this last part that took me a while too...) Alternatively, check out the Radio Group section of the above listed URL, it provides an example using logic:iterate and bean:write but I don't think it allows for different bean getters...someone please correct me if I'm wrong. > > I have to > -> iterate thru the list, which gets me another dataobject with getter > method. > -> then use dataobject's property > > its like a vector inside an object. Any ideas ? > > > So, if I understand you correctly, you have a bean Foo with a method getBar() that returns a Collection? If so, you'll want to just set an attribute on the request with the result of that getter method as I don't think there's a way to handle it otherwise. I did this last week also, so if you want, I can post that code as well. -Adam --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------- Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less.