Re: how do I dynamically include files
% getServletContext().getRequestDispatcher(fileName).include(req,resp); % On May 1, 2008, at 10:35 PM, Jonathan Mast wrote: I know this not exactly a Tomcat issue, but thought someone could help. Here is what I'm trying to do: 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/ %@ include file=directory/%=fileName% % The %=fileName% is not getting evaluated like one would think it should, it is just being rendered as a literal. Any way around this? Thanks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how do I dynamically include files
Thanks Yuval, but the jsp file that fileName is pointing to is not being evaluated. And there aren't any errors printing out to the page. How do I look into what is happening here? On Thu, May 1, 2008 at 6:47 PM, Yuval Perlov [EMAIL PROTECTED] wrote: % getServletContext().getRequestDispatcher(fileName).include(req,resp); % On May 1, 2008, at 10:35 PM, Jonathan Mast wrote: I know this not exactly a Tomcat issue, but thought someone could help. Here is what I'm trying to do: 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/ %@ include file=directory/%=fileName% % The %=fileName% is not getting evaluated like one would think it should, it is just being rendered as a literal. Any way around this? Thanks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how do I dynamically include files
On Thu, May 1, 2008 at 12:35 PM, Jonathan Mast [EMAIL PROTECTED] 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 [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how do I dynamically include files
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how do I dynamically include files
Will JSTL work with Tomcat 5.5? And if so is it a lot of work to set up or do I just drop a jar file in the classpath? On Thu, May 1, 2008 at 7:10 PM, Hassan Schroeder [EMAIL PROTECTED] wrote: On Thu, May 1, 2008 at 12:35 PM, Jonathan Mast [EMAIL PROTECTED] 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 [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how do I dynamically include files
On Thu, May 1, 2008 at 1:20 PM, Jonathan Mast [EMAIL PROTECTED] wrote: Will JSTL work with Tomcat 5.5? And if so is it a lot of work to set up or do I just drop a jar file in the classpath? Yes, no, and yes respectively :-) Just drop jstl.jar and standard.jar in your webapp's lib directory and put the appropriate tag includes at the top of the relevant files. HTH! -- Hassan Schroeder [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how do I dynamically include files
Yuval was right, all I had to do was make the whole argument in jsp:include a variable and it works! On Thu, May 1, 2008 at 7:25 PM, Hassan Schroeder [EMAIL PROTECTED] wrote: On Thu, May 1, 2008 at 1:20 PM, Jonathan Mast [EMAIL PROTECTED] wrote: Will JSTL work with Tomcat 5.5? And if so is it a lot of work to set up or do I just drop a jar file in the classpath? Yes, no, and yes respectively :-) Just drop jstl.jar and standard.jar in your webapp's lib directory and put the appropriate tag includes at the top of the relevant files. HTH! -- Hassan Schroeder [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]