This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
please just explain me what happens :- 1)after sendError() has been executed and we write to the response. there is ambiguity in answers given in JWEBPLUS and Study Kit. 2)after forward() has been executed and we write to the response.
3)it is mentioned in Study kit book that setStatus() method does not trigger the error page machinery and just sends the status code directly to the browser, but it is triggering .... the error page mapped in web.xml for that status code is being displayed.
If you call setStatus (it doesn't matter if it's an error or non-error status code), the servlet is still responsible for providing the body of the response to the client. Now, if the status code is, say, 404, and you'd mapped this to an error page in the deployment descriptor, then this probably explains why your error page is being displayed.
IllegalStateException will be thrown if continue to write to reponse after sendError(), sendRedirect(), forward() has being called. setStatus() will be ignored after the response has been committed. [ September 23, 2003: Message edited by: chi Lin ]
not so smart guy still curious to learn new stuff every now and then