Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling Ajax response in struts2

 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have an AJax call in a Jacascript function which would go to an Action class. Based on the value sent I need to send back an ArrayList, in short I want to know how to handle an Ajax response and the best way to send value from action class.


 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You can convert that List into JSONArray or JSONObject and write the same on OutputStream.
On the client side , in success event handler ( Whatever you choose to implement Ajax on Client Side), parse the JSON String JS libraries and use it further to fulfill the requirements.

Refer http://json.organd http://jquery.com/.

Regards,
Amit
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually in action class I have like this...



"Selectedconcept" is what is passed in the Ajax call... Based on that I need to populate attributes of th passed value and they are stored in that json and the name I gave is "atVal...

I am stuck in defining the struts.xml and populating with that List...

I added Json plugin and gave like this...


in jsp...



where atVal is my Json name...


what are the changes required?? My first attempt at JSON and it's all sea!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic