wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Which one would be invoke first, why? 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 "Which one would be invoke first, why?" Watch "Which one would be invoke first, why?" New topic
Author

Which one would be invoke first, why?

Yorck Zhou
Greenhorn

Joined: Jan 04, 2003
Posts: 22
hi,
can anyone please tell me which one would be invoked first in a servlet:
request.getRequestDispatcher("xxx.jsp").include(req, res)
or
pageContext.include("xxx.jsp")
?


----------------------------------<br />SCJP SCWCD<br />dive into EJB, drinking hot Java
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
within a servlet you can't invoke pageContext.include("xxx.jsp") since this object is unknown to servlets. While writing servlets you must invoke Dispatcher.include(ServletRequest,ServletResponse) in a dispatcher aquired with the invocation of ServletContext.getRequestDispatcher or ServletRequest.getRequestDispatcher!
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
Sorry, its not Dispatcher, it's RequestDispatcher, and you can get a RequestDispatcher by invocating ServletContext.getNamedDispatcher.
Yorck Zhou
Greenhorn

Joined: Jan 04, 2003
Posts: 22
oh, sorry, it should be invoked in a JSP not a servlet.
then can you tell me which one would be invoked first in a JSP:
request.getRequestDispatcher("xxx.jsp").include(req, res)
or
pageContext.include("xxx.jsp")
?
 
 
subject: Which one would be invoke first, why?
 
Similar Threads
Can someone help me in this whether is this possible ?
Cannot find FacesContext
Internationalization problem about tomcat4.0
Lost session value
setting principle in request object