Here is the web.xml at top level (Tomcat/conf/web.xml), there is
really nothing special about it.  Our regular applications don't
really need web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
    version="2.4">

    <servlet>
        <servlet-name>default</servlet-name>
        
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>fork</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>xpoweredBy</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>

    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
...(mime-mappings)
        <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
    </welcome-file-list>
</web-app>

JSP code uses cross context includes and it's really complicated
although there is nothing wrong with the code.  We have 2 contexts.

Here is a sample index.jsp from context /

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>
<c:import url="/shared/header.jsp" context="/apps" />

<table border="0" cellpadding="0" cellspacing="0">
<tr> 
        <td valign="top" width="310">
                <c:import url="/news/HPNews.jsp" context="/apps" /><br>
                <c:import url="/events/HPEvents.jsp" context="/apps" /><br>
                <c:import url="/memoirs/HPMemoirs.jsp" context="/apps" /><br>
                <c:import url="/links/HPLinks.jsp" context="/apps" /><br><br>
        </td>
        <td width="1" valign="top" bgcolor="#FF9900"><img
src="/pics/spacer.gif" width="1" height="1"></td>
        <td width="14" valign="top"><img src="/pics/spacer.gif" width="14"
height="1"></td>
        <td width="200" valign="top">
                <c:import url="/bbmessages/HPBBMessages.jsp" context="/apps" 
/><br>
                <c:import url="/directory/HPDirectory.jsp" context="/apps" 
/><br>
                <c:import url="/minien/HPMinien.jsp" context="/apps" /><br><br>
        </td>
</tr>
</table>

<c:import url="/shared/footer.jsp" context="/apps" />


Here is a part of header.jsp from context /apps

<%@ page contentType="text/html; charset=utf-8" language="java"
import="xxx.EC" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
<%@ include file="/shared/ec.jsp" %>
<!-- <%= ec.getServerID() %> -->
<% session.setAttribute("ts", new Long(System.currentTimeMillis())); %>

<% if (ec.isClosed()) { %>
        <meta http-equiv="Refresh" content="0; URL=/apps/closed.jsp">
        <script language="javascript">
                window.location.href = "/apps/closed.jsp";
        </script>
<% } else if (ec.isUnderConstruction() &&
ec.getHttpHost().indexOf("ednet.ws") < 0) { %>
        <meta http-equiv="Refresh" content="0; 
URL=/apps/under_construction.jsp">
        <script language="javascript">
                window.location.href = "/apps/under_construction.jsp";
        </script>
<% } %>

<html>
<head>
        <title><%= ec.getWebsiteName() %></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="description" content="<%= ec.getWebsiteName() %>">
        <meta name="generator" content="<%= ec.get("general.generator") %>" />
        <link rel="shortcut icon" type="image/ico" href="/favicon.ico">
        <style type="text/css"><c:import url="/shared/main.css" context="/" 
/></style>
        <script language="JavaScript" src="/apps/js/common.js"></script>
</head>

<c:import url="/shared/header.jsp" context="/" />


Please note that header.jsp in /apps includes another header.jsp in /.
 The second header.jsp in / doesn't have any includes.  It's plain
HTML code...


HPNews.jsp in context /apps is something like this:

<%@ page contentType="text/html; charset=utf-8" language="java"
import="xxx.EC, xxx.MySQLTable, xxx.StringUtils, xxx.News" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>
<%@ include file="/shared/ec.jsp" %>
<%
        News news = new News(ec, pageContext);
        MySQLTable newsList = news.getHPNews();
%>
...
<% if (version.equals("3") || version.equals("4")) { %>
        <c:import url="/shared/objects/flash_detect.jsp" >
                <c:param name="FlashVersion" value="5" />
        </c:import>
<% } %>
...

Please let me know what you think.  Thanks in advance!

Asim

On Tue, 29 Mar 2005 15:20:01 -0500, Ramu, Vinod <[EMAIL PROTECTED]> wrote:
> Could we get the jsp code and web.xml configuration?
> 
> Vinod
> 
> -----Original Message-----
> From: Asim Alp [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 29, 2005 3:14 PM
> To: Tomcat Users List
> Subject: include / c:import problems
> 
> Hi,
> 
> We're using Tomcat 5.5.7 on Windows Server 2003 with Sun's J2SE 5.0.
> From time to time, we have problems with jsp:includes and c:imports.
> For some reason, the whole page gets included more than once.  For
> example;
> 
> on index.jsp, we have news.jsp and events.jsp includes.
> 
> From time to time here is what happens:
> index.jsp loads.  news.jsp gets included.  Instead of events.jsp
> index.jsp gets included.  On that second index.jsp, news.jsp and
> events.jsp gets included successfully.  We end up getting very weird
> looking pages.
> 
> We have no idea why this happens as the code is correct.  In fact, the
> page loads correctly after a refresh.  This seems to happen once every
> 100 loads...
> 
> Any ideas?
> 
> Asim
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

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

Reply via email to