• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

[Struts 2] How to populate select control after selection of a value in another select control

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm a newbie in Struts 2 and I don't find a good way to link <s:select> on my JSP page.

I have 3 <s:select> populated via 3 linked hierarchic tables : GROUP (id_group, group) > CATEGORY (id_category, id_group, category) > SKILL (id_skill, id_category, skill)

Here is my JSP page, a classic search & list form :



My java class contains methods :

listSkill(), listCategory(), listGroup() and associated Getter and Setter.

When I select a Group, I would like the <select> that display categories only contains categories of the selected Group.
Same thing for Category and Skills.

Thanks a lot !
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use javascript.


 
Nicolas Benhamou
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to me, a full javascript solution is not a good one. I would like to minimize client role.
Of course, I tried to do that kind of thing :

On my <select> onchange event :



In my listCategory java method, I retrieve the selected idGroup via the associated getter and then, I load the List<Category>.
Finally I set the list with new values.

In Ecclipse debug mode, the list is the right one but on my jsp page, the <select> is not refreshed.

Maybe a cache problem ?

Thanks !

 
Rototillers convert rich soil into dirt. Please note that this tiny ad is not a rototiller:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic