Which HTTP method and corresponding HttpServlet method should be used when a user clicks on the Submit button of a FORM used for capturing the username/password of the user? a. FORM & doForm() b. GET & doGet() c. POST & doPost() d. PUT & doPUT() The ans given is c. But the default method for FORM is GET and hence option b should be correct choice if nothing is mentioned about the method used in the FORM. Pls clarify. Thanks.
These are the *key* parts of the question: Which HTTP method and corresponding HttpServlet method should be used when a user clicks on the Submit button of a FORM used for capturing the username/password of the user? should be used - meaning -- how should you design this form so that its designed in the best way? used for capturing the username/password - this is the key part of the question -- you don't want a username/password to be included in the URL in plain view -- so you'll want to "hide it" in a POST request. [ April 07, 2003: Message edited by: Jessica Sant ]
Boy, that question had me fooled too. Until I read Jessica's response. I guess you have to remember to use your common sense when answering these questions, just as you would in real development, and not just what you've gotten from books. Obviously common sense, once it's reawoken, says that you don't want to put the login and password in a query string for all to see.
Originally posted by Sumit Amar: Well Jessica seems to be a real guru in SCWCD stuff.
As much as I like the compliment -- please doubt everything you ever read that I (or anyone else) types. I've been wrong before and guarantee I'll be wrong again. So.. read the answer someone gives you -- and then try it out for yourself -- write up a lil web app -- throw in the code, see what happens -- check the spec, search through the archives... Does the answer make sense??