日期:2014-05-17  浏览次数:20798 次

SSH配置
有SSH方面的高手吗?我原来有个工程1是SSH做的,后来新建一工程,先做了个登陆,还用SSH,我按照工程1的配置写,开始配struts,没连数据库,只是判断特值可以登陆成功,然后配Spring+hibenate,开始web.xml中没配<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
< stener-class>
< stener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>,index.jsp可以打开,提交后报No wedapplicatontext,就是说找不到资源文件,配上这后,就报404了,这是什么问题呢
附上我的三个xml文件
web.xml
<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>0</load-on-startup>
  </servlet>
  <servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
  <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

struts-config.xml
<struts-config>
  <data-sources />
  <form-beans>
  <!--登陆Form -->
  <form-bean name="loginForm" type="webexp.form.LoginForm" />
  </form-beans>
  <global-exceptions />
  <global-forwards />
  <action-mappings>
  <!--登陆 -->
  <action path="/login" name="loginForm" scope="request" type="webexp.action.LoginAction">
  <forward name="success" path="/main.jsp"/>
  <forward name="fail" path="/login.jsp"/>
  </action>
  </action-mappings>
  <controller
processorClass="org.springframework.web.struts.DelegatingRequestProcessor" />
  <message-resources parameter="com.yourcompany.struts.ApplicationResources" />
</struts-config>


applicationContext.xml
<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/s