• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Spring and Ajax

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
priyanka kulathilaka
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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


 
Ranch Hand
Posts: 32
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please provide more details.

Does your controller is still not get called?
 
priyanka kulathilaka
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 32
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic