欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 前端技术 > javascript >内容正文

javascript

SpringMVC的环境搭建

发布时间:2025/4/14 javascript 59 豆豆
生活随笔 收集整理的这篇文章主要介绍了 SpringMVC的环境搭建 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

第一节 SpringMVC的环境搭建

2016年3月7日 星期一

09:04

 

MyBatis框架-->持久层框架-->Object【对象】Relation[关系型数据库]Mapping[在MyBatis的体现是哪个映射文件中国的<resultMap>标签]框架  对JDBC的封装,需要定制SQL语句

处理的是DataAccessOBject数据访问对象

 

SpringMVC它隶属于Spring框架,它只是Spring这个庞大框架下的一个小模块,SpringMVC是替换我们之前学过的Servlet,在我们下面的课程的时候需要你回顾Servlet

 

如何学习一个框架?

1.找jar

2.配置核心配置文件

3.读取核心配置文件

4.测试Hello World

读取核心配置文件:MyBatis的时候,是由我们自己控制读取mybatis-config.xml Java

SpringMVC框架,WEB层,动态Web项目

第一步:找到Jar[19个]

第二步:建立核心配置文件

 

The DispatcherServlet is an actual Servlet (it inherits from the HttpServlet base class), and as such is declared in the web.xml[部署描述符] of your web application. You need to map requests that you want the DispatcherServlet to handle, by using a URL mapping in the same web.xml file. This is standard Java EE Servlet configuration; the following example shows such a DispatcherServlet declaration and mapping:

 

Servlet的生命周期

发送请求——>如果你是第一次访问获取使用服务器进行初始化操作 init()方法实例化

--》service方法->判断用doget、dopost

<load-on-startup>1</load-on-startup>

<load-on-startup>当服务器启动的时候就对该Servlet实话,并且值越小越被优先加载</load-on-startup>

 

 

 

JSP的生命周期[自己去百度]

 


Upon initialization of a DispatcherServlet, Spring MVC looks for a file named [servlet-name]-servlet.xml in the WEB-INF directory of your web application and creates the beans defined there, overriding the definitions of any beans defined with the same name in the global scope.


 


 

 


 

 

 

跳转:

请求转发:地址栏路径不变[默认的跳转方式]

 

重定向:地址栏改变


配置视图解析器


 

 

 

 

Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'homeController' method

 


 

 

 

 

 

 

 

转载于:https://www.cnblogs.com/skycodefamily/p/5348194.html

总结

以上是生活随笔为你收集整理的SpringMVC的环境搭建的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。