• 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

[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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to use javascript.


 
Nicolas Benhamou
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !

 
Look! It's Leonardo da Vinci! And he brought a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic