Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Niko's servlet mock exam question 45

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Niko's servlet mock exam at
https://nikojava.wordpress.com/2009/03/12/free-scwcd-mock-exam-for-servlets/,
question 45


What is the output when the form is submitted? (1 correct answer)

a. GET
b. POST
c. A HTTP 405 message informs that GET is not supported.
d. A HTTP 405 message informs that POST is not supported.

The given answer is d


But when I code it, the answer is b. It prints out POST.


Niko's mock exams can be found at http://www.coderanch.com/t/659877/Wiki/Scwcd-Mock-Tests
 
Paul Clapham
Sheriff
Posts: 21567
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you copy and paste that code, so that the parameters of doPost() are in a different order from the parameters of doGet()? Or did you retype it in such a way that both methods have their parameters in the same order?
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Paul. Thanks.
My post method was



It works.

When I swap the order of HttpServletRequest and HttpServletResponse, it returns POST method not supported error.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic