In one mock exam, they ask for the type of response when the following url is asked: http://localhost:8080/test/servlet/com.baboon.servletmodel.TestServlet?param=12 The author says blank page witthout error. I've tested it and i received a 405 error: http method GET not supported by this URL. So who is right, and is there any default implementation of GET method provided by the container in the case of no one is implemented by the developer? Thanks in advance, Regards, Cyril.
SCJP 1.4, SCWCD, SCBCD, IBM XML, IBM Websphere 285, IBM Websphere 287
I believe the 'real world' experience is the correct answer (browser receives a 405).
Any exam (mock or not) that asks you what a browser screen should look like, is IMHO, rubbish.
If you have friendly error messages turned on in IE, you'll get a different looking screen than if you have them turned off. If you're using an old netscape version, you might get a popup dialog that says "page contained no data", while other browsers present a blank page. Sometimes when you view the source, it contains an empty <html><body></body></html> other times, it's completely blank.
Joined: Jul 02, 2003
Hi Mike, thanks for your response. What I still not understand is why an exception is generated. Assume the following asserts are correct: GenericServlet has an abstract service(ServletRequest, ServletResponse) method. HttpServlet extends GenericServlet and provides a concrete implementation of the service() method. It also provides the empty implementation for the doXXX() methods. There's anyway an empty implementation of doGet method provided by the container for the class HttpServlet, so why an exception is thrown? What is also the utility of such a default implementation? Thanks for your lignt on this topic, Regards, Cyril.