This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes JavaRanch MockExamQuestion Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "JavaRanch MockExamQuestion" Watch "JavaRanch MockExamQuestion" New topic
Author

JavaRanch MockExamQuestion

Divya Guttikonda
Ranch Hand

Joined: Mar 09, 2005
Posts: 47
Here is a Mock Exam Question from JavaRanch:

A client types the URI :
http://www.someserver.com/servlet/SomeServlet?name=fred
The value of name can be obtained by:

a)doGet(HttpServletRequest request, HttpServletResponse response)
{
String name = response.getParameter("name");
...


b) service(HttpServletRequest request, HttpServletResponse response)
{
String name = request.getParameter("name");
...


c)doGet(HttpServletRequest request, HttpServletResponse response)
{
String name = request.getInitParameter("name");
...


d)doGet(HttpServletRequest request, HttpServletResponse response)
{
String name = request.getParameter("name");
...

The answer given is b, but i think the correct answer is d.Can anybody help me with this?

Thanks
Divya.
Sirisha Reddy
Ranch Hand

Joined: Jun 09, 2003
Posts: 75
i dont see why d is not correct answer ?!


SCJP 1.4
shiva viswanathan
Ranch Hand

Joined: Aug 12, 2004
Posts: 152
Hey I think both b and d are correct answers since ultimately the service method calls the doGet method passing the same HttpServletRequest
method
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: JavaRanch MockExamQuestion
 
Similar Threads
Error 400:
Running a servlet on Tomcat using Eclipse
HTTP method GET is not supported error when the JSP is making POST request to the servlet
Database Access Repeated Each Time
how to call JSP from Servlet