Spring may help you settling up the server-side code to respond to Ajax requests, but the client-side code will be the same regardless of what is being used on the server. Spring will play not part there.
It's highly recommended to use jQuery to do your event handling and Ajax in an easy and cross-browser manner.
Monica. Shiralkar wrote:
Everything is to be done on Client side only. There is not much difference on the server side.On internet I saw examples on "Using Ajax in struts","Using Ajax in Spring" etc whereas most of the thing has to be rather done on the client side only.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
Your URL is malformed. Firstly, it should not have the protocol or host/port portion, so lose the "http://localhost:8080" part.
Secondly, your URL should be server-relative such that it starts with the context path of your application. How to do this properly is discussed in the JspFaq under the ResourceUrlProblems heading.
@Controller
public class MyAjaxController {
@RequestMapping(value = "${pageContext.request.contextPath}/getAjaxProductInfo", method = RequestMethod.POST)
public @ResponseBody Product getProductMoreInfo(@RequestParam("productId") String productId) {
And lastly, why are your mappings ending with ".htm"? Bad idea.
And .htm is a bad idea because it fools things into thinking it's static HTML. This is less of a problem today than it used to be, but could still result in odd caching issues. Why use it?