File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts2 problem with ModelDriven interceptor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 problem with ModelDriven interceptor" Watch "Struts2 problem with ModelDriven interceptor" New topic
Author

Struts2 problem with ModelDriven interceptor

M. White
Greenhorn

Joined: Dec 27, 2009
Posts: 18

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

Joined: Aug 03, 2008
Posts: 9313
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
M. White
Greenhorn

Joined: Dec 27, 2009
Posts: 18

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

Joined: Aug 03, 2008
Posts: 9313
    
  17

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

Joined: Dec 27, 2009
Posts: 18

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 problem with ModelDriven interceptor