Spring parameter binding

  Annotation reference

Parameter binding is simply that the client sends a request, and the request contains some data, so how does this data reach the Controller? This is also the most used in actual project development, so how is the parameter binding of SpringMVC implemented? Let's explain in detail below.

 1. SpringMVC parameter binding

 In Spring MVC, the data submitted to the request is received through the method parameters. The key / value data requested from the client is bound to the parameter of the Controller through parameter binding, and then the parameter can be used directly in the Controller.

                                                   

 Here is the parameter binding component, so what is the parameter component, which can be understood as converting the requested data into the data we need is called the parameter binding component, which is the parameter binding converter. SpringMVC has a lot of parameter converters built-in, only in very few cases do we need custom parameter converters.

 2. Types supported by default

 SpringMVC has supported default parameter types. We can directly use these default types by giving declarations of these default types on the formal parameters. as follows:

  ①, HttpServletRequest object

  ②、HttpServletResponse 对象

Guess you like

Origin blog.csdn.net/qq_41893274/article/details/105204910