我在用spring+struts+hiebtnate的时候 在struts_config.xml里面不配置<plug-in/>和<controller/>的时候struts的业务流程可以进行,比如:http://localhost:8080/xx/xxx.do 可以找到action 但是加入<plug-in/>和<controller/>后 就会报错:Invalid path was requested 
The requested resource (Invalid path was requested) is not available.
请问是怎么回事啊!

解决方案 »

  1.   

    在web层中去调用服务层操作数据库,在struts-config.xml中设置action类用spring来代理,这需要在struts-config.xml中添加插件,<plug-in
              className="org.springframework.web.struts.ContextLoaderPlugIn">
              <set-property property="ContextConfigLocation"
              value="/WEB-INF/action-servlet.xml" />
     </plug-in>并且将Action改为type="org.springframework.web.struts.DelegatingActionProxy",在WEB-INF下建立一个spring的配置文件:action-servlet.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"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"></beans>
      

  2.   

    不配置spring代理还好 配置了spring代理 一些不要spring代理的struts就不能运行了
      

  3.   

    是不是没一个Action都必须要在spring的beans。xml文件里面配置啊?
      

  4.   

    既然用了struts+spring为什么还要用spring去代理struts的action呢  struts的mvc就很好用了 spring只要善用IOC和ID就行了
      

  5.   

    你现在用的是struts+spring你在不在spring里配不配都可以你如果配了就是把这个类注入进来了,如果不配你就new 出来就好了.当然你的struts需要spring整合的时候才用代理类,如果不用就不要代理类.还有如果你要整合需要导入4个包.光导入一个spring的核心包可能运行的时候会出错