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

spring 和structs2 整合开发404错误
新手找了好就,不知道问题在哪,求个位大侠指点,下面上代码和图
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
  <display-name></display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <filter>
   <filter-name>struts2</filter-name>
   <filter-class>
   org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
   </filter-class>
  </filter>
  <filter-mapping>
   <filter-name>struts2</filter-name>
   <url-pattern>/*</url-pattern>
  </filter-mapping>
  <listener > 
<listener-class > 
org.springframework.web.context.ContextLoaderListener
</listener-class > 
</listener > 
<context-param>
<param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/classes/applicationContext.xml
        </param-value>
</context-param>
  </web-app>

structs.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>

 <package name="default"  extends="struts-default">
        <action name="login" class="org.LoginAction">
            <result name="success">/login_success.jsp</result>
        </action>
    </package>
    </struts>

applicationCintext.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"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<bean id="login" class="org.LoginAction">
    </bean>
</beans>


LoginAction.java:

package org;

import com.opensymphony.xwork2.ActionSupport;

public class LoginAction  extends ActionSupport{
private String username;
private String password;
public String execute(){
return ActionSupport.SUCCESS;
}
public String getUsername(){
return username;

}
public void setUsername(String username){
this.username=username;

}
public String getPassword(){