This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Sturts+Ajax populate combobox based on another combobox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Sturts+Ajax populate combobox based on another combobox" Watch "Sturts+Ajax populate combobox based on another combobox" New topic
Author

Sturts+Ajax populate combobox based on another combobox

Mel Cen
Greenhorn

Joined: Apr 23, 2011
Posts: 7
hi guys,

based on this code given by google search,


and my own codes:
combobox1



combobox2



my action class


i found out that the onchange works by making an ajax request but i have no idea how to control the processStateChange function.


this is what i get when i did the onchange.



Uploaded with ImageShack.us

can anyone guide me on how does document.getElementById("componentCombo").innerHTML = req.responseText; works ?

or how can i populate combox2 collection based on selection from combox1 the right way using ajax and sturts.

Thanks in advance.
pooja par
Ranch Hand

Joined: Feb 14, 2011
Posts: 31
document.getElementById("componentCombo").innerHTML = req.responseText;

so now if the response text is array of arrays/list/map etc.. what ever it is, it will be displayed in the componentCombo
The reponse that you get from your action class should be in one of that format(array of arrays/list/map etc..)
 
GeeCON Prague 2014
 
subject: Sturts+Ajax populate combobox based on another combobox