• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to render a jsp through ajax in springmvc

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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....
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic