At 01:05 PM 3/10/00 +1100, Anthony Jereley wrote:
>Hi,
>
>I would like to include a jsp file, the path for which would be generated at
>run-time. Something like this:
>
>documentRoot is a string constant from another class. For example "home/"
><%!
>        String getPromo = new String("/" + documentRoot + "promoimage.jsp");
>%>
>
><%@
>        include file = getPromo
>%>
>
>Is there a way to do this?
>
>Thanks
>Anthony

Is this under JSP .92? Because I encountered a bug (?) when trying to do
something similar to what you're trying to do, using server side includes
to do a dynamically determined include (under IPlanet Web Server Enterprise
edition 4.0).

I had something like

<!--#include file="<%=sessionInformation.getNextURL()%>" -->

I checked the generated java code for the include statement:
  RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(
      "sessionInformation.getNextURL()");
  dispatcher.include(request, response);

Not particularly useful. So I ended up just ditching the <!--..--> and
putting in:
<%
  RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(
    sessionInformation.getNextURL());
  dispatcher.include(request, response);
%>

This worked fine. I don't know if your problem is the same or similar, but
it's worth checking out the generated java to see what is going on behind
the scenes.

Chris

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to