烦人的错误HTTP Status 404 - Servlet action is not available

环境是myeclipse+tomcat5.5+mysql;  struts1.2+spring2.5+hibernate3.2
为了测试环境我只建立了一个简单的user表
 
 
      输入后点击提交然后出现HTTP Status 404 - Servlet action is not available,
 
index.jsp页面
(用的是myeclipse自带的web browser)
 

以下为index.jsp的代码

 

<html>
 <head>
  <title>JSP for UserForm form</title>
 </head>
 <body>
  <html:form action="/user">
   password : <html:password property="password"/><br/>
   username : <html:text property="username"/><br/>
   <html:submit/><html:cancel/>
  </html:form>
 </body>
</html>
 
当单击Submit后出现以下错误
 
 

 

以下是ApplicationContext.xml.  struts-config.xml. web.xml三个配置文件的内容,在网上搜了一下解决方案,大多是针对这三个配置文件来说的。请各位看看到底是哪块导致HTTP Status 404 - Servlet action is not available。

1.ApplicationContext.xml配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans
 xmlns=" http://www.springframework.org/schema/beans"
 xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 <bean id="dataSource"
  class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName"
   value="org.gjt.mm.mysql.Driver">
  </property>
  <property name="url"
   value="jdbc:mysql://localhost:3306/salemodel">
  </property>
  <property name="username" value="root"></property>
  <property name="password" value="root"></property>
 </bean>
 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
   <ref bean="dataSource" />
  </property>
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">
     org.hibernate.dialect.MySQLDialect
    </prop>
    <prop key="hibernate.hbm2ddl.auto">update</prop>
   </props>
  </property>
  <property name="mappingResources">
   <list>
    <value>org/saleModel/vo/User.hbm.xml</value></list>
  </property></bean>
 <bean id="userDAO" class="org.saleModel.dao.UserDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 <bean id="userService" class="org.saleModel.service.UserService"
  abstract="false" lazy-init="default" autowire="default"
  dependency-check="default">
  <property name="userDAO">
   <ref local="userDAO" />
  </property>
 </bean>
 <bean name="/user" class="org.saleModel.struts.action.UserAction"
  abstract="false" lazy-init="default"  autowire="default"
  dependency-check="default">
  <property name="userService">
   <ref local="userService" />
  </property>
 </bean></beans>
 
2.struts配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" " http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
  <data-sources />
  <form-beans >
    <form-bean name="userForm" type="org.saleModel.struts.form.UserForm" />//表单类
 </form-beans>
  <global-exceptions />
  <global-forwards />
  <action-mappings >
   //........................................... action类的配置
    <action                                      
     attribute="userForm"
      input="/jsp/index.jsp"
      name="userForm"
      path="/user"                      
      scope="request"
       >                                      
      <forward name="success" path="/jsp/success.jsp" />
      <forward name="failure" path="/jsp/index.jsp" />
    </action>      
        //......................................................................

 </action-mappings>
//....................................... 控制器的配置
<controller>
   <set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
  </controller>
//............................................
  <message-resources parameter="org.saleModel.struts.ApplicationResources" />
 
  //.............................配置spring插件...................
<plug-in className="org.springframework.web.struts.contextLocationPlugIn">
  <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>
</plug-in>
//............................
</struts-config>
3.web.xml配置文件如下:
 
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 
  <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>
    <init-param>
      <param-name>debug</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
//.........
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
//......................
  </servlet-mapping>
//.........................................
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  </web-app>
4. 我的工程目录如下:
 

 
试过了一些网上给出的解决方案,但是还是解决不了所以想请高人帮助下~~
 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值