aspose file tools*
The moose likes Struts and the fly likes Calling struts2 action from javascript 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 "Calling struts2 action from javascript" Watch "Calling struts2 action from javascript" New topic
Author

Calling struts2 action from javascript

Sweta Chauhan
Ranch Hand

Joined: Jul 09, 2010
Posts: 53
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

Joined: Oct 29, 2001
Posts: 8996
    
    9

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.


[How To Ask Questions On JavaRanch]
Sweta Chauhan
Ranch Hand

Joined: Jul 09, 2010
Posts: 53
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

Joined: Oct 29, 2001
Posts: 8996
    
    9

Struts 2 JSON Plugin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling struts2 action from javascript