tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yuval Perlov <yu...@r-u-on.com>
Subject Re: how do I dynamically include files
Date Thu, 01 May 2008 20:17:35 GMT
Actually, I just checked some of our code and this:
<jsp:include page="<%=(String)request.getAttribute("main")%>"></ 
jsp:include>
works...

I think the problem is that you are do mix a string and a runtime  
expression in a tag. These are not html tags - the variables are  
passed to a function - it's all or nothing.


Try:

<% String path = "directory/"+fileName; %>
<jsp:include page="<%=path%>" flush="true"/>




On May 1, 2008, at 11:10 PM, Hassan Schroeder wrote:

On Thu, May 1, 2008 at 12:35 PM, Jonathan Mast
<jhmast.developer@gmail.com> wrote:

> Dynamically include a file where the file name is dynamic.  Neither  
> of the
> following lines of code work:
>
>    <jsp:include page="directory/<%=fileName%>" flush="true"/>

with JSTL:    <jsp:include page="${fileName}" />

(assuming that fileName is in a JSTL scope, of course)

HTH
---
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message