This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Spring and the fly likes using JQuery with Spring 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Spring
Reply 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: 56185
    
  13

Page-relative URLs are always suspect and fragile.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: using JQuery with Spring 3
 
Similar Threads
Junit + ContextConfiguration
Problem running app under Tomcat v7
Persisting request variables beyond pageContext
How to redirect another page with value object fron ajax request
Pass JSON object from server to jQuery and loop on the object