• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javaranch.com Question Bank ID : 51 Section 1 - The Servlet Model

 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javaranch.com Question Bank ID : 51 Section 1 - The Servlet Model



What is the result of compiling the above Servlet and accessing it by typing:
"http://www.javaranch.com/test/HelloServlet"
into the address field of a browser

If we see here, the only thing we have is a servlet class and the URL.
The question never says that there is a appropriate [assume] <servlet> entries in the DD. Hence i assumed that since the DD is not given , the given URL will never invoke the above servlet and simply respond saying that page cannot be found. To my surprise the answer the question was

An error page is returned from the Server. With explaination as
The Servlet does not implement a doGet method so, an error is returned.

and my answer "The server will not find the Servlet due to an incorrect URL." was rejected.

Who is correct? Can we expect such type of questions in exam
 
Ha Minh Nam
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the question lacks of an assumption about mapping to the servlet. Since there is no such an assumption, we'd better to think it has a correct mapping.
So my answer is "An error page is returned from the Server..."
 
Rufus Addis
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both answers could be deemed correct. I wouldn't worry about it, it's not representative of the actual exam!

In my experience the SCWCD questions were well written and unambiguous. They gave you all the information you needed to correctly answer the question.

If faced with an ambiguous question, I take it from the point of view of "what knowledge is this exam question expecting me to demonstrate".

In this scenario it is more likely to be wanting you to demonstrate that you know a typed browser URL request requires a matching doGet() method than a servlet needs a URL mapping in the DD. If they wanted you to demonstrate the latter they'd have at least mentioned the DD in my opinion.

Rufus.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic