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