java 问题,如图,我忘记 <context-param>这作用了?
context-param元素含有一对参数名和参数值,作用是为应用的servlet上下文初始化参数。
application范围内的参数,存放在servletcontext中,在web.xml中配置如下:
<context-param>
<param-name>context/param</param-name>
<param-value>avalible during application</param-value>
</context-param>
springmvc里handlermappering 和hanlderadapter怎么几岁
用户发起请求,请求到DispatchServlet前端控制器
DispatchServlet(中央调度),负责request和response,负责调用处理器映射器查找Hander,负责调用处理器适配器执行Handler,有了前端控制器降低了各各组件之间的耦合性,系统扩展性提高。
DispatcherServlet前端控制器请求处理器映射器HandlerMappering查找Handler,根据一定的规则去查找(比如:xml配置,注解)
HandlerMapping处理器映射器将Handler返回给前端控制器。
DispatcherServlet前端控制器调用HandlerAdapter处理器适配器执行Handler,程序员编写的Handler是按照适配器要求的规则去执行Handler。
Handler执行完成,返回给HandlerAdapter处理器适配器ModelAndView。
处理器适配器HandlerAdapter将ModelAndView返回给DispatchServlet前端控制器。
前端控制器调用ViewResolver根据ModelAndView得到View,然后再进行视图渲染(将模型数据填充到View响应给用户)
前端控制器响应给用户。
spring contextconfiglocation不同地方有什么区别
加上init-param,参数为contextConfigLocation,直接告诉spring配置文件的位置。
可以读入多个配置文件。
mainServlet
<.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:config/applicationContext.xml,
classpath:config/base/base.xml,
classpath:config/base/datasource.xml,
classpath:config/base/aop.xml ...
1
mainServlet
*.do