把struts-config.xml和web.xml替换成随书附带的源码,就能正常运行,可我输的和源码一样啊,查了好几遍了,真郁闷,555

解决方案 »

  1.   

    struts-config.xml:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"><!-- This is the Struts configuration file for the "Hello!" sample application --><struts-config>
      
      <!-- Form Bean Definitions -->
      <form-beans>
        <form-bean name="HelloForm" type="hello.HelloForm" />
      </form-beans>  <!-- Action Mapping Definitions -->
      <action-mappings>
    <!-- Say Hello! -->
        <action path = "/HelloWorld" 
                  type = "hello.HelloAction" 
      name = "HelloForm" 
      scope = "request" 
      validate = "true"
      input = "/hello.jsp" 
        >
    <forward name="SayHello" path="/hello.jsp" />
    </action>
      </action-mappings>  <!-- Message Resources Definitions -->
      <message-resources parameter="hello.application"/></struts-config>web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/dtd/web-app_2_2.dtd">
    <web-app>
    <display-name>HelloApp Structs Application</display-name><!--Standard Action Servlet Configuration -->
      <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>
        <load-on-startup>2</load-on-startup>
      </servlet>  <!--Standard Action Servlet Mapping -->
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>  <--The Usual Welcome File List -->
      <welcome-file-list>
    <welcme-file>hello.jsp</welcome-file>
      </welcome-file-list>  <!--Struts Tag Library Descriptors -->
      <taglib>
        <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
      </taglib>  <taglib>
        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
      </taglib>  <taglib>
        <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
      </taglib></web-app>
      

  2.   

    <?xml version="1.0" encoding="UTF-8"?>
    是不是编码方式问题??
      

  3.   

    要不就是你的struts-config.xml和web.xml文件自己敲错了 这两个文件手写没有不错的可能....