aspose file tools
The moose likes Spring and the fly likes using JQuery with Spring 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "using JQuery with Spring 3" Watch "using JQuery with Spring 3" New topic
Author

using JQuery with Spring 3

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Spring 3.0.5
jQuery 1.5.2

Hello:

I have been trying to make an ajax call with jQuery:


My controller:


I followed the example at http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/ but I'm missing something. The communication gets lost sometime in the response . . . the callback never fires.

Can somebody give me a hint?

Thanks
Eric
Josh Long
author
Greenhorn

Joined: Apr 04, 2011
Posts: 24

I would try making the equivalent request without ajax to see if it caused an error and hence prevented the output from being delivered. One way to test web-service calls (well, besides regular GET requests) is to use Firefox' POSTER plugin (https://addons.mozilla.org/en-us/firefox/addon/poster/). Additionally, give jquery a chance to notify you of the error with an error callback (see http://stackoverflow.com/questions/1740218/error-handling-in-getjson-calls for information on that)


Thanks, Josh Long
Spring Developer Advocate, SpringSource, a division of VMware
http://blog.springsource.org - http://www.joshlong.com
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 62116
    
  68

Page-relative URLs are always suspect and fragile.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Thanks, I get a 406 response "Not Acceptable". I'm looking into that now . . . .
John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Can't solve this 406 . . . added "headers" to @RequestMapping



I put the Jackson jar in my classpath as was recommended.

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
I figured it out. There are two Jackson jars, core and mapper. You need both in your classpath.


Thanks for the help!

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: using JQuery with Spring 3