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

Spring and Ajax

priyanka kulathilaka
Ranch Hand

Joined: Apr 13, 2011
Posts: 36
I try to send form data to controller using ajax..but
I got This Error in alert box..

Error: [object Object]

Here is my JSP Code


Please Help me Friends..to Solve that error

Priyanka Kulathilaka
Software Engineer - Java
Sri Lanka
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

Is there anymore information you can give us. Any stack traces in your console/log?

Are you sure your Controller method is being called? Can you set a break point in it and step through that code?

Also, if your code is running, can you post your code?

Hope that helps

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
priyanka kulathilaka
Ranch Hand

Joined: Apr 13, 2011
Posts: 36
Mark Spritzler wrote:
Also, if your code is running, can you post your code?
Mark



atleast it is not call to my method also ..
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

atleast it is not call to my method also ..


What do you mean? Do you mean the code isn't getting called? Or is it getting called.

In your success function

success: function(response){
// we have the response
var userId= $('#userId').val();
var usersName= $('#usersName').val();
var username = $('#username').val();
var password = $('#password').val();
}

I am confused. Are those values ${} still there? What are you doing with the Response String being returned by the method? Should you be returning the String value that you are returning? Maybe that is where the error occurs.

Also, did you check your console/logs on the serverside to see if there are any exceptions. I am sure if there is an error you can get more details about that error than just what you are showing in your alert.

Mark
priyanka kulathilaka
Ranch Hand

Joined: Apr 13, 2011
Posts: 36
Mark Spritzler wrote:
atleast it is not call to my method also ..


What do you mean? Do you mean the code isn't getting called? Or is it getting called.

I am confused. Are those values ${} still there? What are you doing with the Response String being returned by the method? Should you be returning the String value that you are returning? Maybe that is where the error occurs.

Also, did you check your console/logs on the serverside to see if there are any exceptions. I am sure if there is an error you can get more details about that error than just what you are showing in your alert.

Mark




Thanks for your response friend..
i used $ as a javascript function..


i mean that is not called to my controller Update method also
here is my update method


Tekchand Prasad
Ranch Hand

Joined: Oct 20, 2005
Posts: 32
please provide more details.

Does your controller is still not get called?
priyanka kulathilaka
Ranch Hand

Joined: Apr 13, 2011
Posts: 36
Tekchand Prasad wrote:please provide more details.

Does your controller is still not get called?


ok friend...its solved with spring request & response.
but don't know how to return page from responseText.?

i got success page's html code as responseText
Tekchand Prasad
Ranch Hand

Joined: Oct 20, 2005
Posts: 32
Use the view resolver and model.addAttribute(...) to pass view page and data

refer the below url to find out how to use ModelAndView

http://static.springsource.org/spring/docs/2.0.x/reference/mvc.html#mvc-viewresolver
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring and Ajax