I have a extJs form with fileupload and servlet. After uploading file i want to get response from servlet.
i do this System.out.println("{success:true, error:'error'}");
But in firebug in POST i dont see anything. This code works in case wiht jsp but not servlet. So how to send parametrs from servlet?
System.outPrintStream is not the the output stream of your servlet response. It is still the “standard” system out stream. Most application servers redirect that to a log file.Servlet’s
service()method, as well asdo*()methods of HttpServlet, take ServletResponse respectively HttpServletResponse as a parameter. When implementing a servlet, one can callgetWriter()on that parameter to get aPrintWriteropen on response’s output stream. That can be used to print something to the response.So, your code should be something like:
response.getWriter().println("{success:true, error:'error'}");