aspose file tools*
The moose likes Struts and the fly likes Select box get refresh after populating the data into a table. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Select box get refresh after populating the data into a table." Watch "Select box get refresh after populating the data into a table." New topic
Author

Select box get refresh after populating the data into a table.

kaushal sharma
Greenhorn

Joined: Oct 04, 2009
Posts: 26
Hi All,


Need help.

i have a select box in which the data is populated from database. When i select an option in select box, the relevant data is populated in a table on the same page but the selected option in the select box get refresh and show me the "Select Option" the first value.
I need to know how can i make the selected option visible in the select box after selecting one.


-Thanks & Regards,
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

You didn't mention which version of Struts you are using. Suppose your select tag looks like this


Now if your action looks like this (Struts 2)

Now it will work, the select box will be rendered using the catList list, then if you submit the page, the selected value will go into the category named String. And then when the page will be generated again, the option whose value matches the value of category string, that value will be selected. Remember that you can define a different property to preselect a value using the value attribute of the select tag...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
kaushal sharma
Greenhorn

Joined: Oct 04, 2009
Posts: 26
Hi Ankit,

Thanks for your suggestions. Sending you my code.




hope now you can suggest me more appropriate.

-Thanks & Regards,
Kaushal K. Sharma
kaushal sharma
Greenhorn

Joined: Oct 04, 2009
Posts: 26
Hi All,

Expecting a suggestion. Kindly provide some docs or code to do this.



-Thanks & Regards,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Select box get refresh after populating the data into a table.