aspose file tools*
The moose likes Struts and the fly likes Ajax-Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Ajax-Struts" Watch "Ajax-Struts" New topic
Author

Ajax-Struts

Shihad Salam
Greenhorn

Joined: Dec 15, 2010
Posts: 10
Hi, i am new to struts. I tried to populate a drop down list based on change in another select box. Pieces of code is given:

jsp:
....


javascript fn:




action class: banking.ShowBankBranches.java

--------------------------------------------------------------------------------------------------------------------------------
In Jsp am getting all values. But it is not getting in the drop down (which is marked as bold). How can i get those values in drop down list from action class. Please help me. Its Urgent

Thanks
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8708
    
    6

Welcome to the JavaRanch.
Please UseCodeTags in the future. I have added them to your post so it is readable.
In this line in the JavaScript you create a function:

This should be the name of the callback from the AJAX call where you would populate your DIV.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
You did set the response in text/xml.
so, your statement will be
document.getElementById("branches").innerHTML=xmlhttp.responseXML;
Try this....


Thanks
Vipul Kumar
Shihad Salam
Greenhorn

Joined: Dec 15, 2010
Posts: 10
Hi, thanks for your reply.

When i tried in my javascript fn, i am getting list of values. But my real doubt is how can i get those list of data's in the drop down list of jsp ie, inside <html:select> tag as option. Please help me with code. It will be a great help for me

Thanks
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8708
    
    6

I told you that you need to declare a callback function to handle the reply. vipul gave you a line which would insert HTML at a particular point. That's pretty much all there is to it. What have you done to implement our suggestions?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ajax-Struts
 
Similar Threads
doubt regarding <html:select>
pass <bean:write> to a function
strut exception
Displaying Data From Different Tables in .jsp
enable/disable drop down