This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes access servlet from url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "access servlet from url" Watch "access servlet from url" New topic
Author

access servlet from url

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I met a question saying a servlet A_servlet has implmented doGet(), doPost() and is mapped to an URL http://blah/A_servlet, when a user accesses it, which method will be executed?
A. doGet(), B. doPost(), C. Cannot be determined based on the given info

I chose C while its answer is A. I know the default method for accessing from the URL is doGet(), but there is no info given where that servlet locates, whether its for internal or external usage. There is no info about its security setting. So I think the correct answer should be C. Am I right?


SCJA, SCJP5.0, SCBCD, SCWCD
Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
Since that the question mentioned about the servlet is mapped to http://blah/A_servlet, and a user access it, then it should be possible that the answer is A (doGet). My gut feeling is that the question is expecting you to understand that Post is more appropriate for program to access the servlet (such as HTML form), rather than user.

Just my 2cents.


SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: access servlet from url
 
Similar Threads
POST or GET
about dispatch
Mock exam question - overriding the service() method
HTTP Servlet
Error 405