1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| <context-param> <param-name>contextConfigLocation</param-name> <!—此处指定applicationContext等配置文件的位置--> <param-value>classpath:org.package.example</param-value> </ context-param > <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <servlet> <servlet-name>此处定义一个名字</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-start>1</load-on-start> <!—以下这段可以不配置--> <init-param> <param-name> <!—使用这个指定的话,servlet文件的名字就不是<servlet-name>-servlet.xml,而是servlet-name.xml--> </param-name> <param-value> <!—指定DispatcherServlet的路径--> </param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>servlet-name<servlet-name> <url-pattern>*.x(如*.html等)</url-pattern> <!-指定处理某种后缀的http请求类型--> </servlet-mapping>
|