Struts1项目不能在Tomcat v7.0上运行

时间:2012-01-23 16:15:11

标签: jsp tomcat struts

我有一个Struts 1项目,可以在Tomcat v6.0上正常运行。但是在Tomcat v7.0上它不会渲染jsp文件。

例如:

我的index.jsp:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<jsp:root xmlns="http://www.w3.org/1999/xhtml" xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
xmlns:bean="http://struts.apache.org/tags-bean-el"
xmlns:html="http://struts.apache.org/tags-html-el"
xmlns:room="http://www.uni-passau.de/roomplanner/taglib" version="2.0">

<jsp:output doctype-root-element="html"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
<jsp:directive.page contentType="text/html; charset=ISO-8859-1" language="java"/>

<html:html xhtml="true">
<head>
<title><bean:message key="index.title" /></title>
<link rel="stylesheet" type="text/css"
    href='${pageContext.request.contextPath}/styles/default.css' />
<html:base />
</head>
<body>
<jsp:directive.include file="/WEB-INF/include/header.html" />
<h1><bean:message key="index.title" /></h1>
<ul class="menu">
    <li><html:link forward="faculty">
        <bean:message key="index.faculty" />
    </html:link></li>
</ul>
<ul class="menu">
    <li><html:link forward="admin">
        <bean:message key="index.admin" />
    </html:link></li>
</ul>
</body>
</html:html>

如果我在Tomcat v7.0上运行项目,我在浏览器中看到的只是列表中的两个点,但没有内容,没有标题,......!在“视图源”窗口中,与index.jsp文件中的代码完全相同,这意味着Tomcat没有呈现jsp文件。

有人知道那是怎么回事吗? (该项目在Tomcat v6.0上运行没有任何问题)

struts版本太旧了吗? (但struts 1.3.10在Tomcat v7.0上运行,我已经测试过了)

谢谢!

这是我的web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

<display-name>Roomplanner Web-Application</display-name>

<description>Roomplanner Web-Application</description>

<welcome-file-list>
       <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

<servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>
        org.apache.struts.action.ActionServlet
    </servlet-class>
    <init-param>
        <param-name>config</param-name>
        <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
        <param-name>application</param-name>
        <param-value>roomplanner.web.L10N</param-value>
    </init-param>
    <init-param>
        <param-name>debug</param-name>
        <param-value>3</param-value>
    </init-param>
    <init-param>
        <param-name>detail</param-name>
        <param-value>3</param-value>
    </init-param>
    <init-param>
        <param-name>companyName</param-name>
        <param-value>U of P</param-value>
    </init-param>

    <load-on-startup>1</load-on-startup>
</servlet>
<servlet>
    <servlet-name>adminScheduleServlet</servlet-name>
    <servlet-class>
        roomplanner.web.appserver.AdminScheduleServlet
    </servlet-class>
</servlet>
<servlet>
    <servlet-name>facultyScheduleServlet</servlet-name>
    <servlet-class>
        roomplanner.web.appserver.FacultyScheduleServlet
    </servlet-class>
</servlet>
<servlet>
    <servlet-name>pingServlet</servlet-name>
    <servlet-class>
        roomplanner.web.appserver.PingServlet
    </servlet-class>
</servlet>
<servlet>
    <servlet-name>exportServlet</servlet-name>
    <servlet-class>
        roomplanner.web.export.ExportServlet
    </servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>adminScheduleServlet</servlet-name>
    <url-pattern>/admin/scheduleServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>facultyScheduleServlet</servlet-name>
    <url-pattern>/faculty/scheduleServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>pingServlet</servlet-name>
    <url-pattern>/pingServlet</url-pattern>
</servlet-mapping>  
<servlet-mapping>
    <servlet-name>exportServlet</servlet-name>
    <url-pattern>/common/exportServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jnlp</url-pattern>
</servlet-mapping>

<session-config>
    <session-timeout>60<!-- minutes --></session-timeout>
</session-config>

<error-page>
    <!-- insufficient rights -->
    <error-code>403</error-code>
    <location>/error/403.jsp</location>
</error-page>
<error-page>
    <!-- page not existent -->
    <error-code>404</error-code>
    <location>/error/404.jsp</location>
</error-page>
<error-page>
    <!-- <exception-code>500</exception-code> -->
    <error-code>500</error-code>
    <location>/error/ErrorPage.jsp</location>
</error-page>

<jsp-config>
    <taglib>
        <taglib-uri>
            http://www.u-p.de/roomplanner/taglib
        </taglib-uri>
        <taglib-location>/WEB-INF/room.tld</taglib-location>
    </taglib>

    <jsp-property-group>
        <display-name>Ignore EL</display-name>
        <url-pattern>*.jsp</url-pattern>
        <url-pattern>*.jnlp</url-pattern>
        <el-ignored>false</el-ignored>
    </jsp-property-group>

</jsp-config>

<resource-env-ref>
    <description>Hibernate Dialect</description>
    <resource-env-ref-name>hibernate.dialect</resource-env-ref-name>
    <resource-env-ref-type>java.lang.String</resource-env-ref-type>
</resource-env-ref>
<resource-env-ref>
    <description>Hibernate JDBC driver class</description>
    <resource-env-ref-name>
        hibernate.connection.driver_class
    </resource-env-ref-name>
    <resource-env-ref-type>java.lang.String</resource-env-ref-type>
</resource-env-ref>
<resource-env-ref>
    <description>Hibernate JDBC connection URL</description>
    <resource-env-ref-name>
        hibernate.connection.url
    </resource-env-ref-name>
    <resource-env-ref-type>java.lang.String</resource-env-ref-type>
</resource-env-ref>
<resource-env-ref>
    <description>Hibernate JDBC connection username</description>
    <resource-env-ref-name>
        hibernate.connection.username
    </resource-env-ref-name>
    <resource-env-ref-type>java.lang.String</resource-env-ref-type>
</resource-env-ref>
<resource-env-ref>
    <description>Hibernate JDBC connection password</description>
    <resource-env-ref-name>
        hibernate.connection.password
    </resource-env-ref-name>
    <resource-env-ref-type>java.lang.String</resource-env-ref-type>
</resource-env-ref>

<resource-ref>
    <description>SMTP connection</description>
    <res-ref-name>mail/Session</res-ref-name>
    <res-type>javax.mail.Session</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Logs</web-resource-name>
        <url-pattern>/logs*</url-pattern>
    </web-resource-collection>
</security-constraint>
<security-constraint>
    <web-resource-collection>
        <web-resource-name>JSP</web-resource-name>
        <url-pattern>/admin/arrangementEdit.jsp</url-pattern>
        <url-pattern>/admin/arrangementGroupConfirm.jsp</url-pattern>
        <url-pattern>/admin/arrangementGroupEdit.jsp</url-pattern>
        <url-pattern>/admin/arrangementGroupList.jsp</url-pattern>
        <url-pattern>/admin/arrangementList.jsp</url-pattern>
        <url-pattern>/admin/facultyEdit.jsp</url-pattern>
        <url-pattern>/admin/facultyList.jsp</url-pattern>
        <url-pattern>/admin/lecturerEdit.jsp</url-pattern>
        <url-pattern>/admin/lecturerList.jsp</url-pattern>
        <url-pattern>/admin/organizationalUnitEdit.jsp</url-pattern>
        <url-pattern>/admin/organizationalUnitList.jsp</url-pattern>
        <url-pattern>/admin/roomEdit.jsp</url-pattern>
        <url-pattern>/admin/roomEquipmentTypeEdit.jsp</url-pattern>
        <url-pattern>/admin/roomEquipmentTypeList.jsp</url-pattern>
        <url-pattern>/admin/roomList.jsp</url-pattern>
        <url-pattern>/admin/semesterEdit.jsp</url-pattern>
        <url-pattern>/admin/semesterList.jsp</url-pattern>
        <url-pattern>/admin/userEdit.jsp</url-pattern>
        <url-pattern>/admin/userList.jsp</url-pattern>
        <url-pattern>/admin/validationList.jsp</url-pattern>
        <url-pattern>/faculty/arrangementEdit.jsp</url-pattern>
        <url-pattern>/faculty/arrangementList.jsp</url-pattern>
        <url-pattern>/faculty/lecturerEdit.jsp</url-pattern>
        <url-pattern>/faculty/lecturerList.jsp</url-pattern>
    </web-resource-collection>
</security-constraint>
<security-constraint>
    <display-name>Faculty</display-name>
    <web-resource-collection>
        <web-resource-name>Faculty</web-resource-name>
        <url-pattern>/faculty/*</url-pattern>
        <url-pattern>/common/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>faculty</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>
<security-constraint>
    <display-name>Admin</display-name>
    <web-resource-collection>
        <web-resource-name>Admin</web-resource-name>
        <url-pattern>/admin/*</url-pattern>
        <url-pattern>/common/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>admin</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>
<security-constraint>
    <display-name>Login</display-name>
    <web-resource-collection>
        <web-resource-name>Login Page</web-resource-name>
        <url-pattern>/login/login.jsp</url-pattern>
        <url-pattern>/login/j_security_check</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>

<login-config>
    <auth-method>FORM</auth-method>
    <realm-name>jdbc/Authority</realm-name>
    <!-- <realm-name>realm/Authority</realm-name> -->
    <form-login-config>
        <form-login-page>/login/login.jsp</form-login-page>
        <form-error-page>/login/login-error.jsp</form-error-page>
    </form-login-config>
</login-config>

<security-role>
    <role-name>faculty</role-name>
</security-role>
<security-role>
    <role-name>admin</role-name>
</security-role>

<mime-mapping>
    <extension>jnlp</extension>
    <mime-type>application/x-java-jnlp-file</mime-type>
</mime-mapping>
</web-app>

0 个答案:

没有答案