We help IT Professionals succeed at work.

A servlet to handle and ajax get request?


I am using jsp / servlets. I'm looking for an example of a servlet that produces json as its output - I want to use the servlet with an ajax request. Does anyone have a link or example of such a thing? I am googling around but am not sure what the current way to do this is in 2010 and there are a lot of different specs (sorry, am new)

Watch Question

For a servlet there is no different between an AJAX request or other requests.

Only difference is that when you are using AJAX, you cannot redirect to other JSP or servlet. The servlet you are sending the AJAX request to, only has to sent the response.

Response can be in XML/HTML/JSON format. It all depends on what you want to implement