补充原因:
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/D:/work%20document/apache-tomcat-5.5.23/apache-tomcat-5.5.23/webapps/struts2_framework/WEB-INF/lib/struts2-core-2.0.9.jar!/struts-default.xml:8:72 - bean - jar:file:/D:/work%20document/apache-tomcat-5.5.23/apache-tomcat-5.5.23/webapps/struts2_framework/WEB-INF/lib/struts2-core-j4-2.0.9.jar!/struts-default.xml:8:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:193)
... 33 more

解决方案 »

  1.   

    对于初步应用
    只加 struts2-core-2.06.jar
         xwork-2.01.jar
         ognl-2.6.11.jar
         freemaker.2.3.8.jar
         commons-logging-1.0.4.jar
    这5个jar即可
    版本号可能有点不一样,如你用2.09,则可能是struts2-core-2.09.jar
      

  2.   

    给楼主推荐一个视屏教程李兴华的struts2.0的教程 免费的
      

  3.   

    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>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>
    </web-app>
    struts.xml 文档:<?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="HelloWorld" extends="struts-default">
    <action name="HelloWorld" class="org.sunxin.struts2.ch02.action.HelloWorldAction">
                <result name="success">/HelloWorld.jsp</result>
            </action>
    </package>
    </struts>action 是
    package org.sunxin.struts2.ch02.action;import com.opensymphony.xwork2.Action;public class HelloWorldAction implements Action
    {
    private String message;

    public String getMessage()
    {
    return message;
    } @Override
    public String execute() throws Exception
    {
    message = "Hello World!";
    return SUCCESS;
    }
    }
    jsp页面:
    <%@ page contentType="text/html;charset=GBK" %>
    <%@ taglib prefix="s" uri="/struts-tags" %>
    <html>
    <head><title>欢迎页面</title></head>
    <body>
    <h2><s:property value="message" /></h2>
    </body>
    </html>
    我的服务器是tomcat6.0 jdk是1.5
    http://localhost:8080/ch02/HelloWorld.action
    总是出现404错误
    我在随便请求里面任何页面都是404错误
    当我删除 web.xml中的
    <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>
     请求HelloWorld.action会出错 但其他的每问题?
    到底是怎么回事?这个错我已经花了两天时间了还是一筹莫展 只有请求高手帮帮忙了!