Spring MVC and AJAX integration example

Table of Contents 1. Introduction SpringMVC AJAX 2. Environment settings & related configurations 3. Create Spring MVC project 4. Create Controller 5. Front-end page design 6. Display data: 1. Introduction Spring MVC Spring MVC is a module in the Spring framework for developing web applications based on the Model-View-Controller (MVC) architecture. It provides a flexible […]

springMVC execution process and working principle

SpringMVC execution process: 1. The user sends a request to the front-end controller DispatcherServlet 2. DispatcherServlet receives the request and calls the processor mapper HandlerMapping. 3. The processor mapper finds the specific processor according to the request URL, generates the processor execution chain HandlerExecutionChain (including the processor object and processor interceptor) and returns it to […]

SpringMVC02- View resolver and controller

Environmental description JDK 17 SpringMVC 6.0.6 Tomcat 10.0.12 Thymeleaf 3.1.2.RELEASE Environment preparation Add SpringMVC dependency and Thymeleaf dependency: <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>6.0.6</version> </dependency> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring6</artifactId> <version>3.1.2.RELEASE</version> </dependency> Configuring view resolvers and controllers Configure the view resolver and register the corresponding ViewResolver as a Bean (Thymeleaf template view resolver configuration steps: template resolver -> template […]

SpringMVC–@RequestMapping annotation

@RequestMapping annotation The function of @RequestMapping annotation The location of the @RequestMapping annotation @RequestMapping annotated properties 1. value attribute 2. method attribute 3. params attribute (understand) Replenish @RequestParam @RequestHeader @RequestBody @RequestBody gets request parameters in json format @ResponseBody @RestController annotation Function of @RequestMapping annotation The function of the @RequestMapping annotation is to associate the request […]

final finally finalize difference stream stream Stream method mvc aop ioc understanding the difference between Collection and Collections Nacos AP, CP

Method to create thread 1. The class inherits Thread and overrides the run() method 2. The class implements the Runnable interface and overrides the run() method (no return value, no exception will be thrown) 3. Implement the Callable interface and implement the call() method (with a return value and an exception will be thrown) To […]

The evolution of Java Web technology: from Servlet, SpringMVC to WebFlux

The evolution of Java Web technology: from Servlet, SpringMVC to WebFlux Preface With the rapid development of Internet technology, Web applications face huge challenges when handling massive user access and big data. In this process, Java Web development technology has experienced an evolution from Servlet to Spring MVC to WebFlux. In this article, we will […]

SpringMVC source code: Initialization of DispatcherServlet (3)

In the previous part, FrameworkServlet left onRefresh to DispatcherServlet to complete, So go into DispatcherServlet # onRefresh Refresh the Spring container (the sub-container is refreshed here) @Override protected void onRefresh(ApplicationContext context) {<!– –> initStrategies(context); //The parameter context here is the SpringWeb container created before (and later passed as a parameter to the initialization function of […]

Series 35, Spring + SpringMVC + MyBatis integration

1. Overview Integrate Spring, SpringMVC, MyBatis. 2. Integration steps 2.1, pom <dependencies> <!– Use Sl4j annotations in ordinary maven projects –> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.22</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.32</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.2.10</version> </dependency> <!– Tools –> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.76</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> <version>4.3</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.11</version> </dependency> <dependency> […]

[MySQL Transactions] Multi-version Concurrency Control (MVCC)

Multi-version Concurrency Control (MVCC) Article directory Multi-version Concurrency Control (MVCC) 1 Overview 2. Snapshot reading and current reading 2.1 Snapshot reading 2.2 Current reading 3. MVCC implementation principle of ReadView 3.1 ReadView Overview 3.2 Design ideas 3.3 ReadView rules 3.4 MVCC overall operation process 4. Give examples 4.1 READ COMMITTED isolation level 4.2 REPEATABLE READ […]

Customize SpringMVC interceptor to implement internal and external network access control functions

This article briefly introduces how to customize a SpringMVC interceptor and implement specific functions through the interceptor. First, you need to create a custom interceptor class that implements the HandlerInterceptor interface. package cn.edu.sgu.www.mhxysy.interceptor; import cn.edu.sgu.www.mhxysy.feign.FeignService; import cn.edu.sgu.www.mhxysy.property.NetworkProperties; import cn.edu.sgu.www.mhxysy.restful.JsonResult; import cn.edu.sgu.www.mhxysy.restful.ResponseCode; import cn.edu.sgu.www.mhxysy.util.IpUtils; import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; […]