• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Form question

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I encountered a question on a mock SCWCD exam that asked:
What HTTP method and corresponding HttpServlet method is used when a user clicks on "Submit" button of any standard Form displayed by a browser?
The answer given was :
POST and doPost(HttpServletRequest, HttpServletResponse)
I thought that all requests sent to a servlet invoked the service method, which then decided which doXXX method to invoke based on the type of the request.
[This message has been edited by BJ Grau (edited September 29, 2001).]
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you remember which exam and the exact question? Especially the exact answers available. My inclanation for the answer to this would be "GET" and "doGet" Html forms that do not supply a "method" attribute, use GET as the default or the "standard" method. However the wording of each of the answers could leave "POST" and "doPost" as the only possible choice.
The wording of the objective 1.1 "For each of the HTTP methods, GET, POST, and PUT, identify the corresponding method in the HttpServlet class" leaves out service. Especially when you look at the API and it states for the service method "There�s no need to override this method."
------------------
I Hope This Helps
Carl Trusiak, SCJP2
[This message has been edited by Carl Trusiak (edited September 30, 2001).]
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Carl's right ... GET is the default method for a FORM, unless POST is specified explicitly.

Originally posted by BJ Grau:
I thought that all requests sent to a servlet invoked the service method, which then decided which doXXX method to invoke based on the type of the request.


True, but the question does ask which HTTP method and corresponding HttpServlet method, and of course service is not an HTTP method.
 
Enthuware Software Support
Posts: 4885
60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am assuming this question is from JWebPlus. If you look at the explanation, it notes that although GET is the default method for a FORM but normally (in fact, almost always), POST is used. You might already know the reasons.
This sounds ambigous as the question does not say anything about the method used in the form, but it does say "standard" form.
I got a similar question in the exam and I interpreted "standard" as POST because that's what a form is normally used for. I think, it was marked correct.
HTH,
Paul.
------------------
SCJP2, SCWCD Resources, Free Question A Day, Mock Exam Results and More!
www.jdiscuss.com
Get Certified, Guaranteed!
JQPlus - For SCJP2
JWebPlus - For SCWCD
JDevPlus - For SCJD
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys.
Yes Paul, it is JWebPlus.
I hope Sun is very clear with the questions asked when I take the exam.
 
Do not threaten THIS beaver! Not even with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic