-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy path20181225-B-JAVA-2.html
208 lines (197 loc) · 10.8 KB
/
20181225-B-JAVA-2.html
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>葡萄藤PPT</title>
<link rel="stylesheet" href="https://ptteng.github.io/PPT/css/reveal/reveal.css">
<!-- PPT主题,可以在/css/reveal/theme/中选择其他主题,目前暂时只能使用该模板 -->
<link rel="stylesheet" href="https://ptteng.github.io/PPT/css/reveal/theme/ptt.css">
<!-- syntax highlighting 代码高亮主题 -->
<link rel="stylesheet" href="https://ptteng.github.io/PPT/lib/reveal/css/zenburn.css">
<!-- 打印和PDF输出样式 -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? './css/reveal/print/pdf.css' : '../css/reveal/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<style>
.left{ text-align: left; }
</style>
</head>
<body>
<img src="https://ptteng.github.io/PPT/img/demo/logo.png" alt="" usemap="#pttmap" class="base-logo">
<map name="pttmap">
<area shape="rect" coords="0,0,276,58" href="http://www.jnshu.com" alt="" target="_blank"/>
</map>
<div class="reveal">
<div class="slides">
<section>
<h2>springMVC</h2>
<p>分享人:崔震</p>
</section>
<section>
<p>1.背景介绍</p>
<p>2.知识剖析</p>
<p>3.常见问题</p>
<p>4.编码实战</p>
<p>5.扩展思考</p>
<p>6.参考文献</p>
<p>7.更多讨论</p>
</section>
<section class="stack past" style="top: 0px; display: block;" data-previous-indexv="0" hidden="" aria-hidden="true">
<section style="top: 267px; display: block;" class="" aria-hidden="true">
<h3>1.背景介绍</h3>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p>Spring MVC属于SpringFrameWork的后续产品,已经融合在Spring Web Flow里面。Spring 框架提供了构建 Web 应用程序的全功能 MVC 模块。</p>
<p>使用 Spring 可插入的 MVC 架构,从而在使用Spring进行WEB开发时,可以选择使用Spring的SpringMVC框架或集成其他MVC开发框架.</p>
<p>基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想,将web层进行职责解耦,</p>
<p>基于请求驱动指的就是使用请求-响应模型,框架的目的就是帮助我们简化开发,Spring Web MVC也是要简化我们日常Web开发的。</p>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p></p>
<p></p>
<p></p>
</section>
</section>
<section class="stack past" style="top: 0px; display: block;" data-previous-indexv="0" hidden="" aria-hidden="true">
<section style="top: 267px; display: block;" class="" aria-hidden="true">
<h3>2.知识剖析</h3>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p>1.MVC设计模式</p>
<p>MVC设计模式</p>
<p>M-Model 模型</p>
<p>V-View 视图(做界面的展示 jsp,html……)</p>
<p>C-Controller 控制器(接收请求—>调用模型—>根据结果派发页面)</p>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p>XML配置文件</p>
<p>主要有两个配置文件</p>
<p>web.xml文件,启动前端控制器。</p>
<p>applacationContext.xml文件,对前端控制器的配置</p>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p>SpringMVC工作流程概述</p>
<p>1、客户端向web服务器(如tomcat)发送一个http请求,</p>
<p>web服务器对http请求进行解析,解析后的URL地址如果匹配了DispatcherServlet的映射路径(通过web.xml中的servlet-mapping配置</p>
<p>,web容器就将请求交给DispatcherServlet处理。</p>
<p>2、DispatcherServlet接收到这个请求后,再对URL进行解析,得到请求资源标识符(URI)。</p>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p>然后调用相应方法得到的HandlerMapping对象,再根据URI,调用这个对象的相应方法获得Handler对象以及它对应的拦截器。</p>
<p>(在这里只是获得了Handler对象,并不会操作它,在SpringMVC中,是通过HandlerAdapter对Handler进行调用、控制的)</p>
<p>3、DispatcherServlet根据得到的Handler对象,选择一个合适的HandlerAdapter,创建其实例对象,执行拦截器中的preHandler()方法。</p>
<p>4、在拦截器方法中,提取请求中的数据模型,填充Handler入参,所以所有准备工作都已做好,</p>
<p>开始执行Handler(我们写的controller代码并不是能被直接执行,需要有刚才那些操作,才能转变为Handler被执行)。</p>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p>5、Handler执行完毕后返回一个ModelAndView对象给DispatcherServlet。</p>
<p>6、这个ModleAndView只是一个逻辑视图,并不是真正的视图,DispatcherServlet通过ViewResolver视图解析器将逻辑视图转化为真正的视图</p>
<p>(通俗理解为将视图名称补全,如加上路径前缀,加上.jsp后缀,能指向实际的视图)。</p>
<p>7、DispatcherServlet通过Model将ModelAndView中得到的处数据解析后用于渲染视图。将得到的最终视图通过http响应返回客户端。</p>
</section>
</section>
<section class="stack past" style="top: 0px; display: block;" data-previous-indexv="0" hidden="" aria-hidden="true">
<section style="top: 267px; display: block;" class="" aria-hidden="true">
<h3>3.常见问题</h3>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p>springMVC优缺点</p>
<p>优点:一:完全基于接口编程,真正实现了视图无关。除了jsp,还可以使用Velocity和xstl或其他视图技术,甚至是自定义的视图技术--只需要简单的实现view接口<p/>
<p>二:Spring MVC框架以DispatchServlet为核心控制器,该控制器负责拦截用户的所有请求。<p/>
<p>三:Spring MVC所有控制器都必须实现Controler接口,该接口定义了ModelAndView handleRequest(request,response)方法,通过实现该接口实现用户的业务逻辑控制。</p>
<p></p>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p>缺点一:Spring与MVC 的Servlet API 耦合,难以脱离容器独立运行</p>
<p>二:太过于细分,开发效率低</p>
<p>三:过度追求完美,有过度设计的危7险</p>
<p></p>
</section>
</section>
<section class="stack past" style="top: 0px; display: block;" data-previous-indexv="0" hidden="" aria-hidden="true">
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<h3>4.编码实战</h3>
</section>
</section>
<section class="stack past" style="top: 0px; display: block;" data-previous-indexv="0" hidden="" aria-hidden="true">
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<h3>5.扩展思考</h3>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p>DispatcherServlet:</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p></p>
<p></p>
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
<p></p>
<p></p>
</section>
</section>
<section>
<h3>6.参考文献</h3>
<p>https://www.cnblogs.com/baiduligang/p/4247164.html</p>
<p>https://blog.csdn.net/u011350541/article/details/48434871</p>
</section>
<section>
<h3>7.更多讨论</h3>
</section>
<section>
<h3>分享到此结束</h3>
<p></p>
</section>
<section class="stack past" style="top: 0px; display: block;" data-previous-indexv="0" hidden="" aria-hidden="true">
<section style="top: 267px; display: block;" class="" aria-hidden="true">
</section>
<section class="future" aria-hidden="true" style="top: 198px; display: none;" hidden="">
</section>
</section>
</div>
</div>
<script src="https://ptteng.github.io/PPT/lib/reveal/js/head.min.js"></script>
<script src="https://ptteng.github.io/PPT/lib/reveal/reveal.js"></script>
<script>
// 以下为常见配置属性的默认值
// {
// controls: true, // 是否在右下角展示控制条
// progress: true, // 是否显示演示的进度条
// slideNumber: false, // 是否显示当前幻灯片的页数编号,也可以使用代码slideNumber: 'c / t' ,表示当前页/总页数。
// history: false, // 是否将每个幻灯片改变加入到浏览器的历史记录中去
// keyboard: true, // 是否启用键盘快捷键来导航
// overview: true, // 是否启用幻灯片的概览模式,可使用"Esc"或"o"键来切换概览模式
// center: true, // 是否将幻灯片垂直居中
// touch: true, // 是否在触屏设备上启用触摸滑动切换
// loop: false, // 是否循环演示
// rtl: false, // 是否将演示的方向变成RTL,即从右往左
// fragments: true, // 全局开启和关闭碎片。
// autoSlide: 0, // 两个幻灯片之间自动切换的时间间隔(毫秒),当设置成 0 的时候则禁止自动切换,该值可以被幻灯片上的 ` data-autoslide` 属性覆盖
// transition: 'default', // 切换过渡效果,有none/fade/slide/convex/concave/zoom
// transitionSpeed: 'default', // 过渡速度,default/fast/slow
// mouseWheel: true, //是否启用通过鼠标滚轮来切换幻灯片
// }
// 初始化幻灯片
Reveal.initialize({
history: true,
dependencies: [
{ src: './plugin/markdown/marked.js' },
{ src: './plugin/markdown/markdown.js' },
{ src: './plugin/notes/notes.js', async: true },
{ src: './plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>