This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling struts2 action from javascript

 
Sweta Chauhan
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to call Struts2 action from javascript function. I have searched Google but not able to find any hints to how to do. If anyone have worked on this then please give me any hints.
 
Joe Ess
Bartender
Pie
Posts: 9265
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would invoke it the same way you would invoke any URL. If you just need some information and don't want to reload the page, use the AJAX-style XMLHttpRequest (your action should return XML or JSON). If you want to reload the page, use window.location.
 
Sweta Chauhan
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Ess wrote:You would invoke it the same way you would invoke any URL. If you just need some information and don't want to reload the page, use the AJAX-style XMLHttpRequest (your action should return XML or JSON). If you want to reload the page, use window.location.


Could you please give me any detail on how to return JSON result.
 
Joe Ess
Bartender
Pie
Posts: 9265
10
Linux Mac OS X Windows
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic