struts.xml中为了与struts1的MVC模式整合,需要类似如下的拦截器的引用
<interceptor-stack name="integration"> <interceptor-ref name="static-params"/> <interceptor-ref name="loginForm"/> <interceptor-ref name="model-driven"/> <interceptor-ref name="actionForm-reset"/> <interceptor-ref name="basicStack"/> <interceptor-ref name="actionForm-validation"/> <interceptor-ref name="workflow"/> </interceptor-stack>
这里面拦截器的name有问题(我是从教材的源代码直接拷贝过来的)
查看struts2-struts1-plugin-2.3.16.3.jar里面的struts-plugin.xml
可以看到上面引用的拦截器的名字是
<interceptors> <interceptor name="actionForm-reset" class="org.apache.struts2.s1.ActionFormResetInterceptor"/> <interceptor name="actionForm-validation" class="org.apache.struts2.s1.ActionFormValidationInterceptor"/> <interceptor name="actionForm-commonsValidation" class="org.apache.struts2.s1.ActionFormValidationInterceptor"> <param name="pathnames">/org/apache/struts/validator/validator-rules.xml,/WEB-INF/validation.xml</param> </interceptor> <interceptor-stack name="struts1Stack"> <interceptor-ref name="staticParams"/> <interceptor-ref name="scopedModelDriven"/> <interceptor-ref name="modelDriven"/> <interceptor-ref name="actionForm-reset"/> <interceptor-ref name="basicStack"/> <interceptor-ref name="actionForm-validation"/> <interceptor-ref name="workflow"/> </interceptor-stack> </interceptors> <default-interceptor-ref name="struts1Stack"/>
所以,应该是staticParams,modelDriven,而不是static-params,model-driven
struts2与struts1整合,Unable to load configuration. - interceptor-ref ... struts.xml,布布扣,bubuko.com
struts2与struts1整合,Unable to load configuration. - interceptor-ref ... struts.xml
原文:http://www.cnblogs.com/qrlozte/p/3794756.html