This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes on calling struts2 action by jquery ajax call it does not enter struts action is my config correct? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "on calling struts2 action by jquery ajax call it does not enter struts action is my config correct?" Watch "on calling struts2 action by jquery ajax call it does not enter struts action is my config correct?" New topic
Author

on calling struts2 action by jquery ajax call it does not enter struts action is my config correct?

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 586
Issue I am facing:

On calling struts2 action using Jquery Ajax call it does not go inside Struts2 Action. Please check if my struts config file is correct or Struts2 action return type. These two can be the probable reasons for this.




Steps I tried so far
Tried debugging this using debugger. After ajax call for struts2 action it does not enter the struts2 action despite putting breakpoint.

Code for Sturts2 Action Call using Jquery AJAX:




Code for Struts Action(HelloWorld.java)::




Struts2 config file: struts.xml



I suspect that there is some issue with either struts config file or struts action. Please advice.

Thanks
chen guangchi
Greenhorn

Joined: Sep 16, 2013
Posts: 1
In the config file,you need a result for the "success" which is returned by the loadData method of Action.And the result must be stream type.
it like:
<result name="success" type="stream">
<param name="inputName">bais</param>
<param name="contentType">text/html;charset=utf-8</param>
</result>
A named bais field must be provided in Action Class.


I am a Chinese .Engilsh is not well!Pardon!
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 586
thanks. but I need json response.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: on calling struts2 action by jquery ajax call it does not enter struts action is my config correct?
 
Similar Threads
Struts2 hello world using AJAX Jquery is working but renders html input tags twice.
pass value from struts2 form to javascript
how to populate HTML div using AJAX to iterate and display arrayList values.
Dependable dropdowns in jsp(struts2)
Struts2 Action problem Problem