Meaningless Drivel is fun!*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question from Marcus Green Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Question from Marcus Green" Watch "Question from Marcus Green" New topic
Author

Question from Marcus Green

Amirr Rafique
Ranch Hand

Joined: Nov 14, 2005
Posts: 324

Why this code will give run time error


"Know where to find the solution and how to use it - that's the secret of success."
Priya Viswam
Ranch Hand

Joined: Dec 28, 2006
Posts: 81
The pathname must begin with a "/".

so change
RequestDispatcher dis = sc.getRequestDispatcher("menu.jsp");

this to
RequestDispatcher dis = sc.getRequestDispatcher("/menu.jsp");

and it will work.


SCJP 1.5<br />SCWCD 1.4
warren li
Ranch Hand

Joined: May 23, 2006
Posts: 128
ServletContext getRequestDispatcher's parameter must start with a /


SCBCD 1.3: 94%<br />SCWCD 1.4: 91%<br />SCJP 5: 95%
 
Don't get me started about those stupid light bulbs.
 
subject: Question from Marcus Green
 
Similar Threads
waitFor to get data from server
question from mock exam
HTTP method GET is not supported by this URL
problem with RequestDispatcher
What will happen when you attempt to compile and run the following code