• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown

Ajax in Spring MVC

Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello can any one provide me a simple code to returning a list form controller and displaying it on jsp page using ajax

my searchuser.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">

function doAjaxPost() {
url: "searchuser1",
data: 'search=' + $("#search").val() ,
success: function(response){
// we have the response
var obj = JSON.parse(response);
error: function(e){

alert('Error: ' + e);




<form name="search" method="post">
<input type="text" id="search" name="search">
<input type="submit" value="submit" onclick="doAjaxPost()">
<div id="info" style="color: green;">

And in my controller i wrote

@RequestMapping(value="/searchuser", method=RequestMethod.GET)
public String search()

return "searchuser";
public @ResponseBody Vector searchuser(HttpServletRequest request, HttpServletResponse response)
throws Exception

String user=request.getParameter("search");
Vector v= UserInterface.accessmodules(user);
return v;

but it is giving an error 406

The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.

please help me

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