MyException - 我的异常网
当前位置:我的异常网» J2EE » spring整合struts2 action注入失败 空指针

spring整合struts2 action注入失败 空指针

www.MyException.Cn  网友分享于:2013-02-20  浏览:174次
spring整合struts2 action注入失败 空指针 求助啊
昨天刚刚搭好的 今天一看 竟然空指针了
spring配置
<?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"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
 http://www.springframework.org/schema/tx
     http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-3.2.xsd">

<context:annotation-config></context:annotation-config>
<context:component-scan base-package="com" />

struts2配置
<?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>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts2.ObjectFactory" value="Spring" />
<package name="default" namespace="/" extends="struts-default">

<action name="RegisterDealAction" class="com.action.RegisterDealAction" >
<result name="success">
/registerSuccess.jsp
</result>
<result name="error">
/registerFail.jsp
</result>
</action>
</package>
<!-- Add packages here -->
</struts>    

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>register.jsp</welcome-file>
  </welcome-file-list>
 <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
<!-- default: /WEB-INF/applicationContext.xml -->
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<!-- <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>  -->
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
  <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>*.action</url-pattern>
  </filter-mapping></web-app>

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有