Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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

 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic