日期:2014-05-20  浏览次数:20727 次

刚学struts2 启动tomcat后 老出下面的问题 帮我看看!
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
  "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="loginTest" extends="struts-default">
<action name="login"
class="cn.itcast.struts2.actions.LoginAction">
<result name="success">/success.jsp</result>
<result name="fail">/fail.jsp</result>
</action>
</package>
</struts>

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

  <filter>
  <filter-name>struts2</filter-name>
  <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  </filter>

  <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
  </filter-mapping>

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

上面没配错吧 !!
为什么我一到http://localhost:8080/testStruts2/ 就出找不到页面(去掉filter-mapping 到我项目的index.jsp页面)
服务器启动的时候抱下面错误!!

Unable to load configuration. - bean - jar:file:/E:/tomcat6.0/Tomcat%206.0/webapps/testStruts2/WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:46:178

老说不能 load struts2-core-2.1.2.jar 我这包没少啊 放在环境下了啊!!

------解决方案--------------------
在<struts>下面加
<include file="struts-default.xml"/>

试试看