改变struts.xml的位置引发的Unable to locate configuratio...

    我用maven创建的struts2项目,因为struts.xml的文件不止一个,因此我不想将它直接放在 resource   目录下,因而,我在resource目录下创建了一个struts的文件夹

    

    启动tomcat后报Unable to locate configuration files of the name struts.xml的warming,修改web.xml文件后,问题解决:
     web

    <filter>
        <filter-name>struts2</filter-name>
	 <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	 <init-param>
            <param-name>config</param-name>
            <param-value>struts-default.xml,struts-plugin.xml,struts/struts.xml</param-value>  
        </init-param> 
    </filter>
    主要是,struts2默认从src目录下加载文件,而咱们的文件在struts文件夹下,加上就行了。
相关文章
相关标签/搜索