改變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文件夾下,加上就行了。
相關文章
相關標籤/搜索