Does anyone know if setContentType() needs to always be called to set the content type for the response prior to calling getWriter(). If not, what is the default setting or will there be an exception thrown?
While using servlets, setContentType() has to be explicitly done before getting the PrintWriter. ////////// code /////////////////////// response.setContentType("text/html"); PrintWriter out = response.getWriter(); //////////////////////////////////////// And in Jsp's contentType is by default "text/html" for page directive.
I'm not sure if setContentType() HAS to be called, although it is preferrable. I've developed a Servlet without it and it runs in Tomcat fine. It does produce some rather odd results though, as sometimes it the font of the text changes.
mooooooo ..... tiny ad ....
Devious Experiments for a Truly Passive Greenhouse!