SSM框架开发web项目系列(六) SpringMVC入门
前言
我们最初的javaSE部分学习后,基本算是入门了,也熟悉了Java的语法和一些常用API,然后再深入到数据库操作、WEB程序开发,渐渐会接触到JDBC、Servlet/Jsp之类的知识,期间可能会接触一两个关系型数据库,例如MySQL/Oracle等等。像前面的MyBatis部分,主要是针对JDBC的进一步封装,使得更适用于实际项目开发过程,但是JDBC、MyBatis或者Hibernate都是针对持久层数据库操作,例如查询、更新记录等等,我们开发程序最终的展现对象是用户,而用户操作程序往往用的是什么?各种各样的浏览器,而不是通过我们后台的这些测试代码,用户看不懂代码,也不需要懂。用户只需要点击、需要输入,比如点击一个链接,跳转到一个新页面,页面中的部分数据都是从数据库中查询获取的;又或者是输入一段文本,点击提交按钮,更新的是数据库中的记录。我们要理清的是,这些页面的操作指令是怎样传递到后台服务器,然后访问到数据库的;还有数据库的数据是怎么从后台又传回前端,怎样显示到页面上的?
如果有学习过Servlet/Jsp相关内容,应该会对上面的问题多少有些理解。首先回顾下什么是Servlet,Servlet是运行在我们服务器上的Java程序,作用于中间层,即客户端请求和服务器之间,我们发送请求,控制数据库、业务逻辑、做出响应,返回前端页面数据等等都可以通过其实现。Servlet的生命周期:1.初始化调用init()方法,2.处理客户端请求调用service()方法,3.结束程序调用destroy方法,4.最后垃圾回收。JSP本质上也是Servlet,项目启动,Web容器将JSP的代码编译成JVM能够识别的java类即Servlet。Jsp重点偏向于页面的展示,应用html、CSS、JavaScript等前端技术在这里都不成问题,而Servlet更倾向于后台的业务逻辑、控制转发等等。
SpringMVC是在Servlet基础上进一步封装开发的一套WEB层框架,所以如果能深入理清Servlet的相关内容,那么很容易就可以上手SpringMVC,下面我们先简单回顾一下之前Servlet的实现过程。
Servlet篇
新建一个普通web工程或者maven web工程,通过继承HttpServlet,创建我们自定义的Servlet,如下所示
package com.mmm.servlet; import java.io.IOException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; public class MyServletA extends HttpServlet { @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doPost(req, resp);
} @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//请求转发,相当于一次请求
req.getRequestDispatcher("/a.jsp").forward(req, resp);
//响应重定向,相当于二次请求,前一次请求设置的属性值在页面中将无法获取到
//resp.sendRedirect("./a.jsp");
//这里往往还要通过持久层对象访问数据库,获取或者更新数据
//获取到的数据通过设置属性,然后在前端Jsp页面可以通过el表达式之类的方法拿到然后渲染样式展示出来
} }
这里的/a.jsp,代表Jsp页面路径,为web文件根目录下例如webapp下,所以我们在webapp下简单创建a.jsp如下
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>a.jsp</title>
</head>
<body>
这是a.jsp
</body>
</html>
然后在web文件夹下WEB-INF文件夹下web.xml中<web-app></web-app>节点内添加如下内容
<servlet>
<servlet-name>MyServletA</servlet-name>
<servlet-class>com.mmm.servlet.MyServletA</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServletA</servlet-name>
<url-pattern>/a.do</url-pattern>
</servlet-mapping>
这里的<servlet-name>的值在<servlet>和<servlet-mapping>中要保持一致,<servlet-class>即为我们前面自定义的Servlet全名(含包名),<url-pattern>用于匹配我们在地址栏输入的url地址。例如这里通过localhost:8080/servlet-web/a.do就可以匹配到该Servlet,从而运行到该Servlet中的相关方法,这里会请求转发到a.jsp,如下图所示。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAygAAAB/CAIAAACL9XF0AAAb50lEQVR4Ae3dbWxU153H8TurQB4MjlSxlEokY9IoHRPUgjCkyUobSCPZkqnUfdPY2kixyovNm6zdbV6wfRBFfVgqkdbevGlWcuK+spM3W22wZEtJBfuiT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aEBAQQQQAABBBDIVoDgla0n1RBAAAEEEEAAAa8AwctLQwMCCCCAAAIIIJCtAMErW0+qIYAAAggggAACXgGCl5eGBgQQQAABBBBAIFsBgle2nlRDAAEEEEAAAQS8AgQvLw0NCCCAAAIIIIBAtgIEr2w9qYYAAggggAACCHgFCF5eGhoQQAABBBBAAIFsBQhe2XpSDQEEEEAAAQQQ8AoQvLw0NCCAAAIIIIAAAtkKELyy9aQaAggggAACCCDgFSB4eWloQAABBBBAAAEEshUgeGXrSTUEEEAAAQQQQMArQPDy0tCAAAIIIIAAAghkK0DwytaTaggggAACCCCAgFeA4OWloQEBBBBAAAEEEMhWgOCVrSfVEEAAAQQQQAABrwDBy0tDAwIIIIAAAgggkK0AwStbT6ohgAACCCCAAAJeAYKXl4YGBBBAAAEEEEAgWwGCV7aeVEMAAQQQQAABBLwCBC8vDQ0IIIAAAggggEC2AgSvbD2phgACCCCAAAIIeAUIXl4aGhBAAAEEEEAAgWwFCF7ZelINAQQQQAABBBDwChC8vDQ0IIAAAggggAAC2QoQvLL1pBoCCCCAAAIIIOAVIHh5aWhAAAEEEEAAAQSyFSB4ZetJNQQQQAABBBBAwCvw/8AnyxZYGfdVAAAAAElFTkSuQmCCAA==" alt="" />
上面为一个最基本的从前端http请求到后台服务器,运行Servlet后,返回前端视图的过程。但是实际情况下,前端的请求不会是这样简单拿回一个静态无数据的页面,也不会只有一个,举个例子,如果上面a.do对应一个增加一条商品数据的操作,即在我们自定义的MyServlet中doPost()方法里执行添加操作,那么如果还有删改查操作,按照这里的路子,我们需要再定义MyServletB、MyServletC、MyServletD,然后web.xml添加3段对应的Servlet节点定义,再继续拓展,我们不止对商品进行增删改查,还有员工、销售记录等等进行操作,这样下去,我们得定义和配置多少个Servlet,有的人想到办法,例如商品的操作路径匹配都是a.do,然后加个参数判断,及路径后加上?action=add或者?action=del等等,这样同一类对象的操作我们将其统一匹配到同一个Servlet,在Servlet的方法内部再去根据具体的action操作类型去判断到底要执行哪种操作(运行哪段业务逻辑)。
SpirngMVC更是将这种思想进化到了极致,我们在web,xml只定义有且只有一个Servlet,这个Servlet能匹配到所有的正常请求,然后可以根据路径精确解析到具体的执行某个类的某个方法,这里的类即控制层Controller,例如一个商品的相关操作,我们定义一个商品Controller类,类中定义各种操作方法,需要访问数据库的话,往往是通过Service层对象去调用持久层的代码实现数据库操作。下面就实例一段单独通过SpringMVC来实现中间控制层效果的小案例。
SpringMVC篇
为了方便管理jar包,这里我们可以新建一个maven web项目,pom依赖可参考前面的环境搭建篇,这里同Servlet对比,我们仅需要一个Java类也就是上面提到的controller,然后是一个指定路径下的jsp文件,最后稍微修改一下web.xml,这三步即可简单过一遍SpringMVC的基本运行过程。下面分别详细写出这三步的内容。
DemoController.java
package com.mmm.web; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("demo")
public class DemoController { @RequestMapping(value="/toPage")
public String toPage() {
return "page";
}
}
从上往下,首先@Controller注解属于Spring系列组件bean注解之一,对应web表现层的组件,类似的还有代表业务逻辑层的@Service,代表数据库访问层的@Repositoty,通用组件@Component等等,实际项目中,层与层之间类对象还会相互调用,基于Spring容器的IOC及依赖注入,我们又还会接触到@Autowired,@Autowired等等注解。在这里我们可以简单理解为通过@Controller注解,Spring会识别并实例化这个bean,这个类对象的创建和管理将交由Spring容器去控制。
然后@RequestMapping("demo"),看英文单词意思应该不难理解,Request请求,Mapping映射,请求映射,通过我们客户端例如浏览器那边过来的http请求,前面我们用过的Servlet会通过配置url匹配到访问路径从而匹配到相应的Servlet中,而在这里类似,SpringMVC会根据我们的访问路径匹配到相应的Contoller中的相应方法,是的,这里还会进一步精确匹配到方法。下面@RequestMapping(value="/toPage")即方法名的映射,例如这里把类和方法的映射名组合起来即为demo/toPage,在本例中,我们通过localhost:8080/spring-mvc/demo/toPage,即可匹配到这个DemoController的toPage方法中执行。
可以看到方法的返回值是String字符串类型,这里可以理解为用于获取视图页面路径。下面结合Spring MVC配置文件讲解。
application-mvc.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> <!-- 自动扫描开启 -->
<context:component-scan base-package="com.mmm.web" />
<mvc:annotation-driven/> <!-- Spring MVC视图解析配置-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean> </beans>
这里的<context:component-scan base-package="com.mmm.web" />即用于Spring扫描识别bean注解,例如刚刚讲到的@Controller,而<mvc:annotation-driven/>则用于扫描SpringMVC相关特定注解,例如这里@RequestMapping等等。
下面的视图解析配置即结合刚刚上面讲到的视图页面路径,prefix和suffix分别为前缀和后缀的意思,结合前面的controller中方法,即页面请求转发路径的统一前后缀,前面controller中方法的返回值为"page",那么组合前后缀,即为/WEB-INF/views/page.jsp,而这个路径对应哪里,如下图所示。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVMAAACmCAIAAADoAfs9AAAXLUlEQVR4Ae1df4hcx32flfWHklAs4iaoxFA1vVXD6eIIJ2nMSgEV0oa9S8vFfxwxAamhZRc3qW+xLEzqA2Oqlqaq6Z1DLHb/iKr8YZejSS7Qu7PBFEx9S1zqIIO4WDpRsBInsv9QVo6U7Em3t/3OzHvzZt7v/f32vc/jcfvezHe+M+8z77NvZt7e95Nrt9sMGxAAAqlGYHt7+/z58ydOnCC+t1q7rVZrT6qvFxcHBICAPwJgvj8uSAUC6UYAzE93/+LqgIA/AmC+Py5IBQLpRgDM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AFe3B4gvvQGBcEMA8f1x6Cu0EAv1EAMzvJ5rwBQTGBQEwf1x6Cu0EAv1E4P8Bo8c45mhP/HoAAAAASUVORK5CYIIA" alt="" />
所以我们要在这里创建一个jsp文件,views文件夹也是。
最后在web.xml中加入如下内容
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/application-mvc.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
我们会发现这里也是配置的Servlet,即org.springframework.web.servlet.DispatcherServlet,只不过只配置了这单独一个,映射路径匹配通用请求,同时init-param设置初始参数即我们SpringMVC配置文件路径。这样一来,我们请求都会被SpringMVC系列组件接受、解析路径、分配到相应的Controller的相应方法。
上面步骤结束后,我们发布项目并启动Tomcat服务器,在浏览器地址栏输入http://localhost/spring-mvc/demo/toPage,看到如下页面,即为成功aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABNAAAAC/CAIAAACwvbYuAAAgAElEQVR4Ae3dfXBUdZro8Q4vJoGrCQgkIJpGHWl2nCWMzhBxV4IzDnHVJXPv7hDqztaE9Q8zVbqJureMc2tG2TszZObOSLhaRbxVc+25NVVE7x+G61uYcU2wVgkqS9jhLo060lFeGlQIKCQBJfc553SfPq/dpzvd6Zd8uyhyXn6vn9MoD7+XU+K/rt6Xu89fPdm95VtzD/7v7zR25K4R1IzAlBG48atfOfD/3ku1u+PK58svLs0+dfY/Xpj5+aVZf3QsoWT06hmj15XOOFM682jpzPCM6cMlJRdKShzTcrEABJT/Pi/qX/qfuqJtvfOxf/n1rfM/fuPB1ZteLoDm08S4wMilix+G+uLn7kd33PHtXbv6L3355bivRP7Yuyc03fnyy0szppdMnzHzy0u+6dN8a9as2bnz96YUppPn7in9/u9rHvi3d3+91HTd68mhh7/y5+/+bOyF70UzHHr4hj9/cii9AtW8v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A+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUsQMBZxA+XriGAAAIIIIAAAggggAACuRQg4MylPnUjgAACCCCAAAIIIIAAAkUs8P8Bc1b6YAAAAARJREFUMuxWUw56BHUAAAAASUVORK5CYIIA" alt="" width="916" height="142" />
小结
通过上面基础的实例,我们能一步步理解从Servlet到web框架SpringMVC的使用,实际开发中同样遵循这些基本规则,只不过事更多的业务逻辑、视图文件等等,比如这里讲到页面跳转中的请求转发,那么是否类似Servlet还有响应重定向,还有,Controller中方法我们不一定是跳转到页面,也可以直接传递JSON数据返回前端,以及我们前面学习到的MyBatis封装持久层,那么我们在这里怎么与持久层连接起来去访问数据库查询或者更新数据,还有到底什么是业务逻辑,等等这些都是我们需要考虑的问题,后面准备分别以具体实例展开说明,欢迎一起探讨。
SSM框架开发web项目系列(六) SpringMVC入门的更多相关文章
- SSM框架开发web项目系列(二) MyBatis真正的力量
前言 上篇SSM框架环境搭建篇,演示了我们进行web开发必不可少的一些配置和准备工作,如果这方面还有疑问的地方,可以先参考上一篇“SSM框架开发web项目系列(一) 环境搭建篇”.本文主要介绍MyBa ...
- SSM框架开发web项目系列(三) MyBatis之resultMap及关联映射
前言 在上篇MyBatis基础篇中我们独立使用MyBatis构建了一个简单的数据库访问程序,可以实现单表的基本增删改查等操作,通过该实例我们可以初步了解MyBatis操作数据库需要的一些组成部分(配置 ...
- SSM框架开发web项目系列(五) Spring集成MyBatis
前言 在前面的MyBatis部分内容中,我们已经可以独立的基于MyBatis构建一个数据库访问层应用,但是在实际的项目开发中,我们的程序不会这么简单,层次也更加复杂,除了这里说到的持久层,还有业务逻辑 ...
- SSM框架开发web项目系列(七) SpringMVC请求接收
前言 在上篇Spring MVC入门篇中,我们初步了解了Spring MVC开发的基本搭建过程,本文将针对实际开发过程的着重点Controller部分,将常用的知识点罗列出来,并配以示例.在这之前,我 ...
- SSM框架开发web项目系列(一) 环境搭建篇
前言 开发环境:Eclipse Mars + Maven + JDK 1.7 + Tomcat 7 + MySQL 主要框架:Spring + Spring MVC + Mybatis 目的:快速上手 ...
- SSM框架开发web项目系列(四) MyBatis之快速掌握动态SQL
前言 通过前面的MyBatis部分学习,已经可以使用MyBatis独立构建一个数据库程序,基本的增删查改/关联查询等等都可以实现了.简单的单表操作和关联查询在实际开的业务流程中一定会有,但是可能只会占 ...
- ssm框架下web项目,web.xml配置文件的作用
1. web.xml中配置了CharacterEncodingFilter,配置这个是拦截所有的资源并设置好编号格式. encoding设置成utf-8就相当于request.setCharacter ...
- idea开发web项目框架失效和无法启动问题
不会配置idea的javaweb环境的小伙伴可以点击此链接 idea最新版,配置javaweb环境 很多小伙伴用idea开发web项目可能会出现所有代码都写对了但是无论如何都没法运行的情况,eclip ...
- 使用maven搭建ssm框架的javaweb项目
目前主流的javaweb项目,常会用到ssm(Spring+Spring MVC+Mybatis)框架来搭建项目的主体框架,本篇介绍搭建SSM框架的maven项目的实施流程.记之共享! 一.SSM框架 ...
随机推荐
- 基于 Vue.js 的移动端组件库mint-ui实现无限滚动加载更多
通过多次爬坑,发现了这些监听滚动来加载更多的组件的共同点, 因为这些加载更多的方法是绑定在需要加载更多的内容的元素上的, 所以是进入页面则直接触发一次,当监听到滚动事件之后,继续加载更多, 所以对于无 ...
- 开发H5基本知识摘要
一:开发平台 我在公司开发app主要是在apicloud平台上https://www.apicloud.com/,需要开发的同学可以点击进入这个平台了解: 二:开发工具 既然是在apicloud平台上 ...
- Java 并发专题 : Executor具体介绍 打造基于Executor的Webserver
转载标明出处:http://blog.csdn.net/lmj623565791/article/details/26938985 继续并发,貌似并发的文章非常少有人看啊~哈~ 今天准备具体介绍jav ...
- IDEA定位到类的代码区域(查看类的源码)
经常需要查看某一个类中的成员变量和方法,那么怎么进入到这个类的源码区域呢?在IDEA中只需要使用快捷键: ctrl+shift+t 就可以快速定位到这个类的源码.
- Softmax多分类算法
List<double[]> inputs_x = new List<double[]>(); inputs_x.Add(new double[] { 0.2, 0.3 }); ...
- 伪列:Oracle显示查询结果前几条记录用rownum<=。去掉重复记录,保留最早录入记录:取出最小ROWID
显示6-10行记录: 去掉重复记录,保留最早录入记录:取出最小ROWID SELECT deptno,dname,loc,min(ROWID) FROM dept GROUP BY deptno,dn ...
- 其他函数:值为NULL时的默认值NVL,DECODE
NVL(列,默认数字值),此函数返回值为数值型,非NULL时返回原始值,NULL时返回默认数字值. DECODE:
- vue+express之前后台分离博客
说来惭愧,这么久没有更新过博客了,写个项目练练手吧,打算写一个vue+express的博客 可能这个时间说长不长说短不短 写到哪就是哪吧 我采用的是前后台分离 express采用的是mvc,但 ...
- css:background-position > 精灵技术
background-position : length || length background-position : position || position 取值: length : 百分数 ...
- mysql 证明为什么用limit时,offset很大会影响性能
本文同时发表在https://github.com/zhangyachen/zhangyachen.github.io/issues/117 首先说明一下MySQL的版本: mysql> sel ...