ssm框架配置文件的启动顺序

ssm框架配置文件的启动顺序

核心控制器:DispatcherServlet

请求解析器:HandlerMapping

结果解析器:ModelAndView

视图解析器:ViewResolver

SSM项目服务启动:

项目进入web.xml

ssm框架 中web.xml执行顺序

1.

org.springframework.web.context.ContextLoaderListener

2

contextConfigLocation

classpath:spring.xml

.在启动Web 容器时,自动装配Spring applicationContext.xml 的配置信息。(先执行spring的监听器,因为它实现了ServletContextListener 这个接口,在web.xml 配置这个监听器,启动容器时,就会默认执行它实现的方法。在ContextLoaderListener 中关联了ContextLoader 这个类,所以整个加载配置过程由ContextLoader 来完成

spring 在 web 下的入口在配置文件 web.xml 的监听器中

3

Encoding

org.springframework.web.filter.CharacterEncodingFilter

encoding

UTF-8

Encoding

/*

4

springmvc

org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

classpath:spring-mvc.xml

springmvc

*.action

运行流程:

1.jsp(view)发送请求

2.通过核心控制器DispatcherServlet调用请求解析器:HandlendMapping对请求进行解析,通过映射关系匹配到Controller层

3.在控制层调用业务逻辑层(service),数据持久层(DAO)返回控制层,请求完成获取一个结果,设置一个要跳转的视图,(ModelAndView装载并传输数据,设置视图)

4.核心控制器调用 视图解析器:ViewResolver解析视图,匹配相应的页面实现页面跳转


分享到:


相關文章: