Suppose you have a servlet - com.whiz.ControllerServlet and you need to create a request dispatcher to it using servlet context.
context.getRequestDispatcher("/ControllerServlet") is correct?
When you say that req dispatcher from a context should start from context root, should it not be '/com.whiz.ControllerServlet'? What exactly is the context root?
context.getRequestDispatcher("/ControllerServlet") is correct?
i guess, if you want to forward to a servlet you should use the getNamedDispatcher( ) here is what the spec says -
The getNamedDispatcher method takes a String argument indicating the name of a servlet known to the ServletContext. If a servlet is found, it is wrapped with a RequestDispatcher object and the object is returned. If no servlet is associated with the given name, the method must return null.
SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ] Performance is a compulsion, not a option, if my existence is to be justified.
Paper jam tastes about as you would expect. Try some on this tiny ad:
Gift giving made easy with the permaculture playing cards