File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 1648
    
    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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to render a jsp through ajax in springmvc
 
Similar Threads
Spring 2.5 with Ajaxtags
How to redirect another page with value object fron ajax request
"Request method 'GET' not supported" jsp viewResolver JstlView
What is the difference between using @RequestMapping before class and before method
Spring mvc and Ajax