• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 problem with ModelDriven interceptor

 
M. White
Greenhorn
Posts: 18
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am unable to transfer form data to my model object if I invoke my action using ajax (XMLHttpRequest object). Isnt this possible? Any help/comment is much appreciated.
 
Ankit Garg
Sheriff
Posts: 9520
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its almost impossible to guess the problem with that much information. Did you pass the request parameters properly in the AJAX request?? Can you show us the JavaScript code and Struts code...
 
M. White
Greenhorn
Posts: 18
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is js:


and here is my action class:



I did not pass form parameters in AJAX assuming that the framework will take care of the data transfer.
 
Ankit Garg
Sheriff
Posts: 9520
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The AJAX request is a POST request but you are not sending anything in the body of the request. You can send request parameters in the send method in your javascript code...
 
M. White
Greenhorn
Posts: 18
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess i just have to pass the form parameters in ajax. I thought all along struts will automatically handle the form parameters, just like in the "normal" form submit. Thanks for your help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic