程序員可能會通過Tomcat啟動web應用程序,這個時候會加載web.xml文件,下面錯新技術頻道小編為大家推薦web.xml中如何設置配置文件的加載路徑實例詳解,看看有本文的介紹大家是否喜歡。
web.xml中如何設置配置文件的加載路徑實例詳解
第一種在web.xml中這樣配置:
<context-param> <param-name >contextConfigLocation </param-name > <param-value >classpath:config/XXXXXXX.xml </param-value > </ context-param>
? 表示在類路徑下有一個名為config的文件夾
第二種在web.xml中這樣配置:
<context-param> <param-name >contextConfigLocation </param-name > <param-value >/WEB-INF/config/*-context.xml </param-value > </ context-param>
放在config文件夾下,使用了通配符。兩種方式功能一樣,使用哪個就看個人喜好了。
大家想學習更多的JSP知識嗎?web.xml中如何設置配置文件的加載路徑實例詳解就是上文錯新技術頻道小編推薦的了,這些都是我們日常所需的知識,關注js.VeVb.com,將給大家帶來更多的驚喜。
新聞熱點
疑難解答