Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Monica Shiralkar
Ranch Hand
Posts: 866
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 866
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks. but I need json response.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic