springboot-springmvc-requestParam
springmvc请求方式
1、直接写在形参中:基本类型
@RequestMapping("/testRequestParam1")
public ModelAndView testRequestParam1(String name) {
ModelAndView mv = new ModelAndView();
System.out.println(name);
mv.setViewName("helloworld");
return mv;
}
2、直接写在形参中:pojo
/**
* 页面请求实例:
* <form action="http://localhost:8080/hello/testRequestParam4" method="post">
* <input type="text" name="id"/> <input type="text" name="name"/>
* <input type="submit" value="提交"/> </form>
*/
@RequestMapping("/testRequestParam4")
public ModelAndView testRequestParam4(T1 t) {
System.out.println(t.getId());
ModelAndView mv = new ModelAndView();
mv.setViewName("helloworld");
return mv;
}
3、通过@RequestParam写在形参中
@RequestMapping("/testRequestParam2")
public ModelAndView testRequestParam2(@RequestParam(value = "id") Integer id) {
ModelAndView mv = new ModelAndView();
System.out.println(id);
mv.setViewName("helloworld");
return mv;
}
4、通过@PathVariable写在形参中
@RequestMapping("/testRequestParam3/{id}")
public ModelAndView testRequestParam3(@PathVariable("id") Integer id) {
ModelAndView mv = new ModelAndView();
System.out.println(id);
mv.setViewName("helloworld");
return mv;
}
springboot-springmvc-requestParam的更多相关文章
- springboot+springmvc+mybatis项目整合
介绍: 上篇给大家介绍了ssm多模块项目的搭建,在搭建过程中spring整合springmvc和mybatis时会有很多的东西需要我们进行配置,这样不仅浪费了时间,也比较容易出错,由于这样问题的产生, ...
- SpringBoot+SpringMVC+MyBatis快速整合搭建
作为开发人员,大家都知道,SpringBoot是基于Spring4.0设计的,不仅继承了Spring框架原有的优秀特性,而且还通过简化配置来进一步简化了Spring应用的整个搭建和开发过程.另外Spr ...
- springboot+springmvc拦截器做登录拦截
springboot+springmvc拦截器做登录拦截 LoginInterceptor 实现 HandlerInterceptor 接口,自定义拦截器处理方法 LoginConfiguration ...
- SpringBoot/SpringMVC文件下载方式
本篇文章引用外网博客代码,共描述SpringMVC下三种文件下载方式,本人测试在SpringBoot(2.0以上版本)正常使用. 引用博客,强烈推荐https://www.boraji.com. pa ...
- SpringMvc @RequestParam 使用推荐使用包装类型代替包装类型
SpringMvc 中@RequestParam注解使用 建议使用包装类型来代替基本数据类型 public String form2(@RequestParam(name="age" ...
- springboot springmvc 支持 https
Spring Mvc和Spring Boot配置Tomcat支持Https 背景 最近在项目开发中需要让自己的后端Restful接口支持https,在参考了很多前辈们的博客后总结了一些. Spring ...
- springMVC --@RequestParam注解(后台控制器获取參数)
在SpringMVC后台控制层获取參数的方式主要有两种,一种是request.getParameter("name"),第二种是用注解@RequestParam直接获取. 1.获取 ...
- 【转】springmvc @RequestParam
在SpringMVC后台控制层获取参数的方式主要有两种,一种是request.getParameter("name"),另外一种是用注解@RequestParam直接获取.这里主要 ...
- springboot springmvc 抛出全局异常解决方法
springboot中抛出异常,springboot自带的是springmvc框架,这个就不多说了. springmvc统一异常解决方法这里要说明的是.只是结合了springboot的使用而已.直接上 ...
- SpringMvc@RequestParam 来映射请求参数
jsp页面 <a href="springmvc/testRequestParam?username=atguigu&age=11">Test RequestP ...
随机推荐
- WPF多值绑定及多值转换(MultiBinding和IMultiValueConverter)
WPF可以使用MultiBinding进行多值绑定,使用IMultiValueConverter进行多值转换 例: (1)转换器 public class ContentConverter : IMu ...
- PHP 获取上传文件的实际类型
方案一: mime_content_type ( string $filename ) : string (PHP 4 >= 4.3.0, PHP 5, PHP 7) mime_content_ ...
- django安装好之后,django-admin仍然不能使用的问题
我使用的是python3,python3不能找到django的正确位置.需要下面这样才能正确建立mysite python3 /usr/lib/python2./site-packages/djang ...
- Linux卸载Django
cd /usr/lib/python2.7/dist-packages sudo rm -rf django sudo rm Django-1.8.7.egg-info 基本命令如此,具体文件因版本有 ...
- K3CLOUD 常用数据表
二.K3 Cloud 开发插件<K3 Cloud 常用数据表整理>一.数据库查询常用表 按 Ctrl+C 复制代码 按 Ctrl+C 复制代码 通过表T_META_OBJECTTYPE的F ...
- 聊聊我理解的ANSI C、ISO C、GNU C、POSIX C
几句话了解C标准之间的关系 C语言标准 早期的计算机汇编语言是与机器平台紧密耦合的,为了屏蔽这种耦合,增加代码的可移植性,C语言随机出现. 二十世纪八十年代,为了避免各开发厂商用的C语言语法产生差异, ...
- 用IE滤镜实现多种常用的CSS3效果
CSS3是当下非常火的一个话题之一,很多浏览器都已经开始支持这一特性,然后IE这个拥有庞大用户群体的平台,却无法提供这样的支持,即便是IE9发布,也无法改变这一事实,然而,幸运的是,IE并非在这方面毫 ...
- RedisTemplate 中 opsForHash()使用 (没有测试过,copy的)
1.put(H key, HK hashKey, HV value) //新增hashMap值 redisTemplate.opsForHash().put("hashValue" ...
- php 中秒杀
控制器层 2 //秒杀 首先要判断库存 其次高并发 然后入库 3 public function goods_do() 4 { 5 $gid=input("get.gid"); 6 ...
- MongoDB-查询关键字/排序等
查询关键字 并列查询$and # 条件都成立才可以查询到结果 db.stutent.find({$and:[{name:"小漩涡"},{age:30}]}) 或查询$or # 有一 ...