@RequestParam@RequestParam:接收来自RequestHeader中,即请求头。通常用于GET请求,例如:http://localhost:8080/hello/name=admin&age=18@Target({ElementType.PARAMETER})@Retention(RetentionPolicy.RUNTIME)@Documentedpublic@interfaceRequestParam{@AliasFor("name")Stringvalue()default"";@AliasFor("value")Stringname()default"";bool
@RequestParam@RequestParam:接收来自RequestHeader中,即请求头。通常用于GET请求,例如:http://localhost:8080/hello/name=admin&age=18@Target({ElementType.PARAMETER})@Retention(RetentionPolicy.RUNTIME)@Documentedpublic@interfaceRequestParam{@AliasFor("name")Stringvalue()default"";@AliasFor("value")Stringname()default"";bool
一、@RequestParam主要用于将请求参数区域的数据映射到控制层方法的参数上//http://localhost:8080/wh/user/edit?Id=9452659856325148452&name=天天向上//@RequestParam源码@Target({ElementType.PARAMETER})//只能作用于参数上@Retention(RetentionPolicy.RUNTIME)@Documentedpublic@interfaceRequestParam{//定义参数名称,默认和名字一致@AliasFor("name")Stringvalue()default"";
一、@RequestParam主要用于将请求参数区域的数据映射到控制层方法的参数上//http://localhost:8080/wh/user/edit?Id=9452659856325148452&name=天天向上//@RequestParam源码@Target({ElementType.PARAMETER})//只能作用于参数上@Retention(RetentionPolicy.RUNTIME)@Documentedpublic@interfaceRequestParam{//定义参数名称,默认和名字一致@AliasFor("name")Stringvalue()default"";
@Controller该注解用于类上,代表该类是控制器类,常叫控制层或表现层。带有该注解的类可以调用@Service的实现类@ControllerpublicclassCustomerController{@ResourceCustomerServiceIcustomerServiceI;@PostMapping("/")publicStringindex(){return"list";}}以上代码可以实现跳转到list.jsp页面。@RestController该注解用法和@Controller用法一样,区别是该注解相当于@Controller+@ResponseBody(这个注解下面会讲到
@Controller该注解用于类上,代表该类是控制器类,常叫控制层或表现层。带有该注解的类可以调用@Service的实现类@ControllerpublicclassCustomerController{@ResourceCustomerServiceIcustomerServiceI;@PostMapping("/")publicStringindex(){return"list";}}以上代码可以实现跳转到list.jsp页面。@RestController该注解用法和@Controller用法一样,区别是该注解相当于@Controller+@ResponseBody(这个注解下面会讲到