> -----Original Message-----
> From: Luc Foisy [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, January 08, 2003 1:54 PM
> To: Tomcat User List (E-mail)
> Subject: JSP Question
> 
> 
> 
> I am trying to use <%@ include file="filename" %>
> 
> I am sending to the page that has this with the line: 
> response.sendRedirect("main.jsp?p="+applicationJar.getPageName());
> 
> So in main.jsp I would like to include an external file to 
> insert into a default page, something like:
> 
> <SOME DEFAULT PAGE STUFF HERE>
> <%@ include file="filename" %>
> <SOME DEFAULT PAGE STUFF HERE>
> 
> but I would like to replace "filename" with request.getParameter("p")
> 
> Any one have any idea how to do this?

The <%@ include %> syntax is a static inclusion that happens at
translation time, so it can't depend on runtime parameters.

You want to use:
<jsp:include page='<%= request.getParameter("p") %>'/>
(see the JSP spec for details)

Be forewarned that you won't be able to access the enclosing page's
local variables from within the included page (as you can with static
includes), but if you add those variables to the request context you'll
be able to access them that way.

-- 
Tim Moore / Blackboard Inc. / Software Engineer
1899 L Street, NW / 5th Floor / Washington, DC 20036
Phone 202-463-4860 ext. 258 / Fax 202-463-4863


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to