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.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
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?
I child proofed my house but they still get in. Distract them with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|