aspose file tools*
The moose likes Spring and the fly likes How to render a jsp through ajax in springmvc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "How to render a jsp through ajax in springmvc" Watch "How to render a jsp through ajax in springmvc" New topic
Author

How to render a jsp through ajax in springmvc

Stevenson Anderson
Greenhorn

Joined: Jul 09, 2011
Posts: 13
Hi...

I could not able to make a request through ajax in my jsp. Please do help me.
The code goes like below....

this is the ajax code in jsp page.


And the controller class is



The function doAjaxPost(id) is called and i can see the alert message, We are in doAjaxPost with id "+id .
But after that its getting failed to post the request (There are no messages in the console from showcolumnlist method of controller class).
But getting an error alert " Error : [object Object] "
I could able to make the request without ajax successfully.

Do help me....
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1680
    
    7

I would not use the @ResponseBody on a ModelAndView personally. Are you seeing your sysout? Here is an example of ajax with an mvc controller.

https://github.com/SpringSource/spring-mvc-showcase/blob/master/src/main/webapp/WEB-INF/views/home.jsp

You can browse around that same project to see the controller side or just download the whole thing and import it as an existing maven project into STS. Get it here:
https://github.com/SpringSource/spring-mvc-showcase/downloads


[How To Ask Questions][Read before you PM me]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to render a jsp through ajax in springmvc