{
0 码力 |
259 页 |
3.58 MB
| 2 年前 3
Method Arguments 34
Return Values 36
Type Conversion 37
Matrix Variables 37
@RequestMapping 40
@RequestMapping 42
@CookieValue 43
@ModelAttribute 44
@SessionAttributes 47
@SessionAttribute mappings, and others.The main HandlerMapping implementations are RequestMappingHandlerMapping for @RequestMapping annotated methods, RouterFunctionMapping for functional endpoint routes, and SimpleUrlHandlerMapping view resolution and rendering with an HTML template.
##### 1.4.2. Request Mapping
Web MVC
The @RequestMapping annotation is used to map requests to controllers methods. It has various attributes to match
0 码力 |
182 页 |
2.52 MB
| 2 年前 3
使用基于注解的控制器的几个优点
1. Controller 和 RequestMapping 注释类型是 Spring MVC API 最重要的两个注释类型。
2. 一个控制器类可以处理多个动作(而一个实现了 Controller 接口的控制器只能处理一个动作)。
3. 基于注解的控制器的请求映射不需要存储在配置文件中。使用 RequestMapping 注释类型,可以对一个方法进行请求处理。
## Controller
## RequestMapping 注解类型
####### org.springframework.web.bind.annotation.RequestMapping
在控制类的内部为每一个动作开发相应的处理方法,要让 Spring 知道用哪一种方法来处理它的动作,需要使用该注解类型映射 URI 与方法。
采用 @RequestMapping 注解的方法将成为请求处理方法,并由调度程序在接收到对应 对应 URL 请求时调用。
## @RequestMapping 示例
package com.example.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public
0 码力 |
67 页 |
792.43 KB
| 2 年前 3
Mapping Requests With @RequestMapping ..... 490
Composed @RequestMapping Variants ..... 491
@Controller and AOP Proxying ..... 492
New Support Classes for @RequestMapping methods in Spring MVC 3 Request Parameters and Header Values ..... 499
HTTP HEAD and HTTP OPTIONS ..... 499
Defining @RequestMapping handler methods ..... 500
Supported method argument types ..... 500
Supported method return support ..... 621
Defining a controller with @Controller ..... 622
Mapping requests with @RequestMapping ..... 622
Supported handler method arguments ..... 624
Binding request parameters to method
0 码力 |
916 页 |
5.52 MB
| 1 年前 3
Mapping Requests With @RequestMapping ..... 483
Composed @RequestMapping Variants ..... 484
@Controller and AOP Proxying ..... 485
New Support Classes for @RequestMapping methods in Spring MVC 3 Request Parameters and Header Values ..... 492
HTTP HEAD and HTTP OPTIONS ..... 492
Defining @RequestMapping handler methods ..... 493
Supported method argument types ..... 493
Supported method return support ..... 614
Defining a controller with @Controller ..... 615
Mapping requests with @RequestMapping ..... 615
Supported handler method arguments ..... 617
Binding request parameters to method
0 码力 |
907 页 |
5.46 MB
| 2 年前 3
@Controller
Mapping Requests With @RequestMapping
Composed @RequestMapping Variants
@Controller and AOP Proxying
New Support Classes for @RequestMapping methods
in Spring MVC 3.1
URI Template Producible Media Types
Request Parameters and Header Values
HTTP HEAD and HTTP OPTIONS
Defining @RequestMapping handler methods
Supported method argument types
Supported method return types
Binding request with @Controller
Mapping requests with @RequestMapping
Supported handler method arguments
Binding request parameters to method parameters with
@RequestMapping
Providing a link to data from the model
0 码力 |
1323 页 |
4.08 MB
| 1 年前 3
Mapping Requests With @RequestMapping
Composed @RequestMapping Variants
@Controller and AOP Proxying
New Support Classes for @RequestMapping methods
in Spring Media Types
Request Parameters and Header Values
HTTP HEAD and HTTP OPTIONS
Defining @RequestMapping handler methods
Supported method argument types
Supported method return types
Binding dispatcher for annotation support
Defining a controller with @Controller
Mapping requests with @RequestMapping
Supported handler method arguments
Binding request parameters to method parameters with
@RequestParam
0 码力 |
1311 页 |
4.07 MB
| 2 年前 3