• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
kaushal sharma
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

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



-Thanks & Regards,
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic