• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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: 9708
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,
 
Your mind is under my control .... your will is now mine .... read this tiny ad
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic