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 doubts  getRequestDispatcher 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 "doubts  getRequestDispatcher" Watch "doubts  getRequestDispatcher" New topic
Author

doubts getRequestDispatcher

naresh govindaswmay
Ranch Hand

Joined: Aug 15, 2007
Posts: 90
hi,
7.Following is the code for doGet() method of TestServlet. Which of the given statements about it are correct?

public void doGet(HttpServletRequest req, HttpServletResponse res)

{

try

{

RequestDispatcher rd = this.getServletContext().getRequestDispatcher("Login.jsp"); // 1

rd.forward(req, res); // 2

}

catch(Exception e)

{

e.printStackTrace();

}

}

Select 2 correct options.
A.This will not compile.
B.This will compile but will not work as expected.
C.This code will work just fine.
D.It will compile but not work properly if //1 is replaced with: RequestDispatcher rd = req.getRequestDispatcher("Login.jsp");
E.It will compile and will work properly if //1 is replaced with: RequestDispatcher rd = req.getRequestDispatcher("Login.jsp");

I have selected a and e is the Correct answer. because while using the getservletContext().getRequestDispatcher(); this method will not take the "RELATIVE " path. so that only i made it like that. but they said c and e is teh rite answer. Please Clear this doubt.I am looking for this.


Thanks and Regards<br />Naresh govindaswamy
 
jQuery in Action, 2nd edition
 
subject: doubts getRequestDispatcher
 
Similar Threads
RequestDispatcher question
Problem in Mock exam
doubt on RequestDispatcher
Mock exam questions...
SCWCD mock questions II