• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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: 9692
42
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,
 
Let nothing stop you! Not even this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic