Thanks for your reply :)
I was thinking of some other way, because if I use response.getWriter.close() I get a lot of "Stream closed" exceptions in my trace later on in the application.
I'm using this code as a scriptlet inside a JSP page which is included inside my main JSP page and would like to stop all further JSP rendering.
Any ideas?
The proper way to prevent your code from writing anything more to the response is to use an if-statement:if (canWriteMore) {
// write more output
}
Closing the response and then allowing code to try to write to it is only going to result in exceptions.
Hmm... The problem is that I have a title jsp page which is included in many other jsps. In that title page I check whether there was an error or not and based on that I generate an error message (or not). So I cannot really use such an if statement in the title page because from there I have no access to the data written in the other pages. I guess I'll just have to create such an if statement in all these pages... :/