日期:2014-05-16  浏览次数:20939 次

struts2部署后访问index。jsp报错404
建立一个普通的web项目是可以访问的。
部署struts之后报错404.
配置文件如下(web.xml):
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 
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">
<filter>
<filter-name>Struts2Controller</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Struts2Controller</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

struts.xml如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
    "http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<package name="struts2-demo1" extends="struts-default">
<action name="login" class="tarena.action.Login">
<result name="success" type="dispatcher">/ok.jsp</result>
<result name="login" type="redirect">/index.jsp</result>
</action>
</package>
</struts>
tomcat信息如下:
2013-11-4 21:13:50 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files (x86)\Java\jdk1.6.0_10\jre\bin;D:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\bin
2013-11-4 21:13:50 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2013-11-4 21:13:50 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 402 ms
2013-11-4 21:13:50 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2013-11-4 21:13:50 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.37
2013-11-4 21:13:50 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
2013-11-4 21:13:50 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory dang
2013-11-4 21:13:50 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-default.xml]
2013-11-4 21:13:51 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-plugin.xml]
2013-11-4 21:13:51 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts.xml, skipping
2013-11-4 21:13:51 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Pa