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

急!struts+hibernate+spring出现http 404 servlet action找不到的问题,希望高手指点
web.xml

 <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>0</load-on-startup>
  </servlet>
  <servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  
struts-config.xml
  <struts-config>
<form-beans>
  <form-bean name="giveForm" typ="give.form.GiveForm"/>
</form-beans>
<global-exceptions />
<global-forwards />
  <action-mappings>
<action
path="/agree" 
type="org.springframework.web.struts.DelegatingActionProxy" 
name="giveForm"
scope="request"

validate="false"
>
<forward name="success" path="/give/success.jsp"/>

</action>
 </action-mappings>

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in>  

</struts-config>

 spring的配置文件,分了三个文件来写的。
  application_data.xml
  <bean id="dataSource" 
  class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  <property name="driverClassName">
  <value>com.mysql.jdbc.Driver</value>
  </property>
  <property name="url">
  <value>jdbc:mysql://localhost:3306/test</value>
  </property>
  <property name="username">
  <value>root</value>
  </property>
  <property name="password">
  <value>root</value>
  </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>
</props>
</property>
<property name="mappingResources">
<list>
<value>give/entity/Give.hbm.xml</value>

</list>
</property>
</bean>


<bean id="GiveDAO"
class="give.dao.GiveDAO">
<property name="sessionFactory">
<ref