I'm stuck wiith this too. Pls. help.
helen ge
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
M> cc:
Sent by: A Subject: trouble with<%@ include
file= "filename.jsp" %>
mailing list ,<jsp:include page="name" />
about Java Server
Pages
specification and
reference
<JSP-INTEREST@jav
a.sun.com>
06/03/00 08:47 PM
Please respond to
A mailing list
about Java Server
Pages
specification and
reference
Hello,
I am developing a web application. each web page will include two included
jsp pages, one is the left side navigation menu named left.jsp static page,
anoter is the footer footer.jsp dynamic page.
the footer.jsp will return two links and static text showing this web
page's
last updated time such as
LEGAL | Y2K | last updated time ....
I tried two ways to implement it:
Method 1: using <jsp:include > action
parent jsp page code
<html>
.....
<!-- inlude the left navigation menu -->
<jsp:include page="left.jsp" />
<!-- page body contents here -->
......
<!--inclue footer here and pass this website file name to footer.jsp
-->
<%String filename = request.getPathTranslated(); %>
<jsp:include page="footer.jsp" flush="true" >
<jsp:param name ="filename" value="<%=filename %>" />
</jsp:include>;
</html>
*************************codes for the footer.jsp**************
<%@page import="java.io.* " %>
<%@page import="java.sql.* " %>
<%@page import="javax.servlet.http.* " %>
<div align="center">
<p> <img src="images/blockc.gif" width="300" height="1" alt=""> </p>
</div>
<div align="center">
<font face="Verdana, Arial, Helvetica, sans-serif" size="-2"><a
href="legal.jsp">Legal</a>
| <a href="Y2k.jsp">Year 2000</a> | Updated
<%
String filename = request.getParameter("filename");
File file = null;
try{
file = new File(filename);
}
catch(Exception e){e.printStackTrace();}
long lstTime = file.lastModified();
Date d1 = new Date(lstTime);
String lstDate = d1.toString();
%>
<%=lstDate%>
<br>
© 1997, 1998, 1999 <br>
All Rights Reserved.</font>
</div>
when the child returns, the parent do shows the correct system file date
but when you click the footer other two links I got the error message "
response already commited...."
Method 2: using <%@ include >
partent code:
....
<% String filename=request.getPathTranslated(); %>
<%@ include file="copyright.jsp" %>
...
child footer.jsp code
<%@page import="java.io.* " %>
<%@page import="java.sql.* " %>
<%@page import="javax.servlet.http.* " %>
<div align="center">
<p> <img src="images/blockc.gif" width="300" height="1" alt=""> </p>
</div>
<div align="center">
<font face="Verdana, Arial, Helvetica, sans-serif" size="-2"><a
href="foo.jsp">Legal</a>
| <a href="foo.jsp">Year 2000</a> | Updated
<%
// child can directly using parent page variable filename here
File file = null;
try{
file = new File(filename);
}
catch(Exception e){e.printStackTrace();}
long lstTime = file.lastModified();
Date d1 = new Date(lstTime);
%>
<%=lstDate%>
<br>
© 1997, 1998, 1999 <br>
All Rights Reserved.</font>
</div>
this method works on javawebserver environment but not work on the
apache tomcat environment.
highly appreciated if anyone can help me solve this problem.
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
===========================================================================
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
===========================================================================
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