File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes [Struts 2] How to populate select control after selection of a value in another select control Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "[Struts 2] How to populate select control after selection of a value in another select control" Watch "[Struts 2] How to populate select control after selection of a value in another select control" New topic
Author

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

Nicolas Benhamou
Greenhorn

Joined: Sep 18, 2009
Posts: 2
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 !
Ranveer K Kumar
Ranch Hand

Joined: Sep 13, 2009
Posts: 64
You need to use javascript.


Nicolas Benhamou
Greenhorn

Joined: Sep 18, 2009
Posts: 2
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 !

 
Consider Paul's rocket mass heater.
 
subject: [Struts 2] How to populate select control after selection of a value in another select control
 
Similar Threads
How to get Struts select tag's current selected value/id
Problem while implementing cascade select option in Struts2 [City/Locality/Streets]
Problem with Hidden Tags
Help in Debugging
Equivalent of logic iterate in Struts 2