你的test是怎么注入到action里的?我没用过struts,不懂!不过感觉你并没有为action注入test,所以是null

解决方案 »

  1.   

    private Itest test=null;改为private Itest test;
      

  2.   

    在spring配置文件中又加入
    <bean id="login" class="com.struts.action.LoginAction">
      <property name="test"><ref bean="test"/></property>
    </bean>
    private Itest test=null;改为private Itest test以后
    还是出现null的错误
      

  3.   

    在struts的配置文件中加入一个Spring插件
    <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
       <set-proprety property="contextConfigLocation" value="/WEB-    INF/applicationContext.xml">
    </plug-in>
    这样也是一种方法,可以试试!
      

  4.   

    加过了
    还是一样的问题
    struts的配置我也改了
    <bean name="/login" class="com.struts.action.LoginAction">
      <property name="test"><ref bean="test"/></property>
    </bean>id改为name name值加了一个"/",可还是一样