@RequestMapping("/import") @ResponseBody public Map importItem(@RequestParam("fileName") MultipartFile uploadFile, HttpServletRequest request, HttpSer... ...
分类:
Web程序 时间:
2018-08-27 10:32:29
阅读次数:
232
案例来说明 1 @RequestMapping("user/add") 2 public String add(@RequestParam("name") String name, 3 @RequestParam("age") int age){ 4 System.out.println(name+ ...
分类:
编程语言 时间:
2018-08-18 19:36:20
阅读次数:
185
@RequestMapping("/downLoadXlsFile") public ResponseEntity downLoadXlsFile(@RequestParam("filePath")String path,HttpServletRequest request) throws IOEx... ...
分类:
编程语言 时间:
2018-08-12 14:00:38
阅读次数:
143
一、@RequestParam和@PathVariable的区别 1、@RequestParam是从uri中request后面的参数串来取得参数的 2、@PathVariable是从uri模板中取得参数的 例子: uri:http://localhost:8080/springmvc/hello?p ...
分类:
其他好文 时间:
2018-08-10 13:13:04
阅读次数:
159
今天在用@RequestParam(required=false) int XXX 取参数的时候,当参数没有的时候Spring默认赋值为空。而此时使用基本类型int,所以报错,建议使用包装类 Integer。 参考: https://blog.csdn.net/Hello_l/articl ...
分类:
Web程序 时间:
2018-08-09 15:46:00
阅读次数:
385
1: 常用注解:@RequestMappingRequestMapping是一个用来处理请求地址映射的注解,可用于类或方法上。用于类上,表示类中的所有响应请求的方法都是以该地址作为父路径。@ResponseBody@RequestBody@PathVariable@RequestParam@Cont ...
分类:
编程语言 时间:
2018-08-06 21:10:22
阅读次数:
132
第一:传参方式写法,当参数个数大于2个时,需要用@RequestParam @PostMapping(value = "/configReader/configValue.do",headers = {"Accept=application/json","Content-Type=applicati ...
分类:
其他好文 时间:
2018-08-06 21:08:31
阅读次数:
215
以前写controller层的时候都是默认带上 @RequestParam 的, 今天发现不加@RequestParam 也能接收到参数 下面我们来区分一下加与不加的区别 这里有两种写法 @RequestMapping("/list") public String test(@Reque ...
分类:
编程语言 时间:
2018-08-06 13:01:01
阅读次数:
318
@RequestMapping("/search") public String searchItemList(String keyword, @RequestParam(defaultValue="1") Integer page, Model model) throws Exception { ... ...
分类:
编程语言 时间:
2018-08-05 11:48:39
阅读次数:
121
获取url模板上数据的(/{id})@DefaultValue 获取请求参数的(包括post表单提交)键值对(?param1=10¶m2=20)、可以设置defaultValue JAX-RS @PathParam @QueryParam Spring @PathVariable @Requ ...
分类:
其他好文 时间:
2018-07-30 00:30:06
阅读次数:
277