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 Ajax-Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion 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: 8995
    
    9

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.


[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: 8995
    
    9

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?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Ajax-Struts