Don't use sendError() - use setStatus(). Also - se the status first as to ensure the response is not committed before you send th body of the page. Also - once the page is done - try and close the resonse to ensure any error handling by tomcat is not done.

-Tim

Anurag Chakravarti wrote:
Hi,

Tomcat sends back a default error HTML page, even when I don't want it
to. I want my servlet to send its own error response body. I am doing
the following in my servlet doPut method.

java.io.PrintWriter pr = resp.getWriter();
pr.println(e.getErrorCode().serialize());
resp.sendError(e.getCode());

This does not work. Tomcat sends me a HTML page which I don't want.
What am I missing here.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to