tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Delisle <pierre.deli...@sun.com>
Subject Re: include behavior
Date Thu, 26 Oct 2000 16:34:18 GMT
When a problem like this happens, I always go to the simplest
possible situation, make it work, and then work my way 
to the problematic case.

Lets' say you have two files, foo.jsp and bar.jsp, both located 
at the root of your web app:

--- foo.jsp
<h1>This is foo.jsp</h1>
I'm including bar.jsp
<%@ include file="/bar.jsp" %>
After bar.jsp

--- bar.jsp
bar.jsp
<h1>This is bar.jsp</h1>

If you try accessing:
http://localhost:8080/<webapp>/foo.jsp

This should work. Please give it a try and let us know.
I suspect that the file you are trying to include is
not located at the right place.

	-- Pierre


John Fisher wrote:
> 
> Hi,
> 
> Thanks for the response. This produces the same results:
> 
> <jsp:include page="common/header.ssi" flush="true" >
> </jsp:include>
> 
> Note that header.ssi does not contain executable code, it is basically a
> hunk of html code to be inserted. As such, I don't have any parameters I
> need to pass. Perhaps JSP is trying to execute header.ssi, and the error
> messages are being stiffled somehow?
> 
> John
> 
> -----Original Message-----
> From: Dave Smith [mailto:sat-guru@home.com]
> Sent: Thursday, October 26, 2000 8:06 AM
> To: fisher23@llnl.gov
> Subject: Re: include behavior
> 
> I think your include needs a closing tag. You can also add arguments:
> 
> <jsp:include page="servlet/SomeServ" flush="true">
> 
>     <jsp:param name="id" value="<%=someid%>" />
> 
> </jsp:include>
> 
> Dave
> 
> ----- Original Message -----
> From: "John Fisher" <fisher23@llnl.gov>
> To: <tomcat-user@jakarta.apache.org>
> Sent: Wednesday, October 25, 2000 8:00 PM
> Subject: include behavior
> 
> >
> >
> > I could really use some help here. Originally, I had static pages that
> used
> > Apache's Server Side Includes to put a header at the top of the page. The
> > header is <webroot>/common/header.ssi. My <webroot> is both the Apache
> root
> > and Tomcat's webapps directory (webapps is a symbolic link). I've
> introduce
> > Tomcat into the equation. I can get JSP pages working pretty well, even
> > loading data from an Oracle database.
> >
> > I'm trying to get either the <%@ include %> or the <jsp:include page=.../>
> > mechanism to work, but I get nothing but errors. If I put in:
> >
> > <%@ include file="/common/header.ssi" %>
> >
> > I get "Bad file argument to include". If I put in:
> >
> > <%@ include file="../common/header.ssi" %>
> >
> > I get "Cannot read file: /../common/header.ssi". If I put:
> >
> > <jsp:include page="common/header.ssi" flush="true" />
> >
> > I get no errors, but the resulting HTML code is empty (the rest of the
> page
> > executes fine - it's just results in a blank line where the jsp:include
> > was). I can try other page values here, but the result is the same. No
> > errors, but no results.
> >
> > I'm pretty stuck here. Any ideas? If I just want to include a "chunk of
> > HTML" at the top of each page, which one of the mechanisms above is
> > appropriate, and how can I get it to work?
> >
> > Much thanks,
> > John
> >
> >

Mime
View raw message