SpringMVC

SpringBoot与web开发(四)-----登录拦截

拦截器登录

准备工作 页面downloadboostrap的官方实例页面,方便练习 资源来自:https://getbootstrap.com/docs/4.3/examples/ 资源的目录如下: 1.controller层 package com.changyue.springbootresetfucrud.controller; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpSession; import java.util.Map; /** * @program: spring-boot-restful-crud * @description: 用户控制器 * @author: YuanChangYue * @create: 2019-08-13 17:59 */ @Controller public class LoginController { /** * 用户登录 * * @param username 用户名 默认测试 123 * @param password 密码 默认测试 123 * @param map map * @param httpSession session * @return 页面名称 */ @PostMapping("/user/login") public String login(@RequestParam("username") String username, @RequestParam("password") String password, Map<String, Object> map, HttpSession httpSession) { if ("123".

SpringBoot与Web开发(三)-----Spring MVC

Spring Boot 中 Spring MVC 自动配置 ,Spring MVC的拓展 ,全面接管SpringMVC

Spring Boot 与 Spring MVC 根据SpringBoot 官方文档中的资料 ,可以看出SpringBoot和SpringMVC的关系。 本章节提到的官文文档地址如下: <https://docs.spring.io/spring-boot/docs/2.1.7.RELEASE/reference/html/boot-features-developing-web-applications.html#boot-features-spring-mvc-auto-configuration 1. Spring Boot 中Spring MVC 自动配置 官方文档中的原文如下: Spring Boot provides auto-configuration for Spring MVC that works well with most applications. The auto-configuration adds the following features on top of Spring’s defaults: Inclusion of ContentNegotiatingViewResolver and BeanNameViewResolver beans. 自动配置viewResolver (视图解析器:根据方法返回的值获得视图对象 ) ContentNegotiatingViewResolver : 组合所有的试图解析器 自定义:==可以自己给容器中添加视图解析器 ,自动为我们组合起来== Support for serving static resources, including support for WebJars (covered later in this document)).