日期:2014-05-18  浏览次数:20729 次

Struts + tomcat 5出现在奇怪问题
初学struts,在调第一个小应用时,首页可以正常显示,当点提交时出现如下错误:
HTTP   Status   404   -   Servlet   action   is   not   available

type   Status   report

message   Servlet   action   is   not   available

description   The   requested   resource   (Servlet   action   is   not   available)   is   not   available.
----------------------------

以下为web.xml文件:
<?xml   version= "1.0 "   encoding= "ISO-8859-1 "   ?>

<web-app   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 "
        version= "2.4 ">

<icon> </icon>
<display-name> Struts   Base   Application </display-name>
<description> Struts   Base   Application </description>

<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> 1 </load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name> action </servlet-name>
<url-pattern> *.do </url-pattern>
</servlet-mapping>
</web-app>

---------------------------

以下为struts-config.xml:
<?xml   version= "1.0 "   encoding= "ISO-8859-1 "   ?>

<!DOCTYPE   struts-config   PUBLIC
                    "-//Apache   Software   Foundation//DTD   Struts   Configuration   1.1//EN "
                    "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd ">
                   
<struts-config>
<form-beans>
                                     
        <form-bean               name= "testForm "
                                          type= "org.apache.struts.validator.DynaValidatorForm ">
            <form-property   name= "name "   type= "java.lang.String "/>
                    <form-property   name= "comments "   type= "java.lang.String "/>
        </form-bean>

</form-beans>

<action-mappings>
<action   path= "/test "
        type= "com.wrox.begjsp.ch19.struts.TestAction "
      &