Oops! I made a big mistake! jsp:include is not equivalent to what I said
below! It is (more or less) equivalent to :

<%
getServletConfig().getServletConfig().getRequestDispatcher("/servlet/TestSer
vlet").include(request, response); %>

In fact, it is exactly equivalent to :

<% application.getRequestDispatcher("/servlet/TestServlet").include(request,
response); %>

because the java code generated when the jsp is compiled defines the
"application" local variable to hold the ServletContext

The RequestDispatcher obtained from a ServletContext can't be use with a
relative path, unlike the one obtained from a request.

For more information, write a test jsp, run it and open the generated source
code!

Pierre-Yves

-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Envoy� : mercredi 25 juillet 2001 15:47
� : A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology.
Objet : RE: <jsp:include />


Hi,

The include is context relative, ie, you must not specify the context. So,
the correct syntax is:

<jsp:include page="/servlet/TestServlet" flush="true"/>

which is equivalent to:

<% request.getRequestDispatcher("/servlet/TestInclude").include(request,
response); %>

You must not forget the leading / (if you forget it, the path will be
relative to the current directory, and not to the context document root
directory).

Pierre-Yves

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to