How to write characters in http response
To send response to the http client, you need a reference to the output stream of the http response. This is provided by the PrintWriter object obtained from the method PrintWriter getWriter() of the HttpServletResponse object as shown below and then call the println(String) method on it.
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { PrintWriter pWriter = resp.getWriter(); pWriter.println("It works."); }