"Richard Sand" <[EMAIL PROTECTED]> on 01/07/2002 09:40:31 PM

Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>

To:   <[EMAIL PROTECTED]>
cc:

Subject:  server side includes of dynamic content not working?

Hi all-

I'm using Tomcat 4.01 on Win2k and I'm trying to get a server side include
to work.  I'm using the SSI "include virtual", and what I'm experiencing is
that if I include a static file, it works (so I have taken the basic steps
to get SSI working on Tomcat), but if I try to include the contents of
another servlet, such as:

<!--#include virtual="/servlet/ipa.MenuServlet"-->

...I always get back "[an error occured processing this directive]".
However, I know the include tag is valid, because if I configure my Apache
to serve the shtml file (instead of passing the request to tomcat), then
the SSI works.  So I suspect that it is a problem with Tomcat's SSI
handling.

Can anyone confirm this?

What's really odd is that I tried doing a <jsp:include page=...> on the
same URI, it returns blank, i.e. no content inserted! But I know the URI
itself is valid because I can cut and paste it into my browser and it
returns my proper content.

So is there a problem doing a jsp:include on a servlet as well? Does it
matter that the servlet is in another context than this page?

Both <jsp:include.../> and <% include.../> directives are meant to be used
with URLs that are relative to the context. If you wish to include a
servlet from another context then would need to get a handle to that
ServletContext and then use RequestDispatcher.include(...).
Example code:
   ServletContext ctx = application.getContext("/ssi");
   RequestDispatcher rd = ctx.getRequestDispatcher
("/<relative_path/<file_to_be_included>");
   rd.include(request, response);


Any help greatly appreciated!

Thanks!

-Richard

I hope this helps.
Thanks.
RS








--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to