HTTPServletResponse.setStatus and error page

R

reformy

hey
from the HTTPServletResponse.setStatus(int sc) API:
"Sets the status code for this response. This method is used to set the
return status code when there is no error (for example, for the status
codes SC_OK or SC_MOVED_TEMPORARILY). If there is an error, and the
caller wishes to invoke an error-page defined in the web application,
the sendError method should be used instead."

I understand from this, that the following code:

response.setStatus(SC_CONFLICT);
response.getOutputStream().println("<html><body>error</body></html>");

should NOT invoke the error page (i have an error page defined for
409-conflict in my web.xml). But still - i get the error page and not
what i've printed into the output-stream.
why?

thanks
yair
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top