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 ...
随机推荐
- #2002 Cannot log in to the MySQL server, PHPMyAdmin/MySQL
改完会可能会出现1045的错误 在phpStudy中,其他选项菜单——mysql工具——重置密码,即可
- css选择器学习(二)属性选择器
属性选择器 /*******************************************css2中的属性选择器*************************************** ...
- Pandas to_sql TypeError: sequence item 0: expected str instance, dict found
问题介绍 打印了一下数据格式,并未发现问题.如果说是字典实例引起的. 我猜测也是extra字段引起的,因为extra字段是一个json字段.根据网上的提示要对这样的格式进行强转str. 其他发现:pd ...
- redis在应用中使用连接不释放问题解决
今天测试,发现redis使用的时候,调用的链接一直不释放.后查阅蛮多资料,才发现一个配置导致的.并不是他们说的服务没有启动导致的. 1)配置文件 #redis连接配置================= ...
- jQuery.merge(first,second)
jQuery.merge(first,second) 概述 合并两个数组 返回的结果会修改第一个数组的内容——第一个数组的元素后面跟着第二个数组的元素.要去除重复项,请使用$.unique() 参数 ...
- pyecharts v1 版本 学习笔记 散点图
散点图 基本案例 from example.commons import Faker from pyecharts import options as opts from pyecharts.char ...
- Oracle 审计 部署监控 user DML操作
1.移动audit表及索引到dbadmin表空间 alter table aud$ move tablespace DBADMIN;alter table AUDIT$ move tablespace ...
- vue中修改第三方组件的样式不生效
问题 在使用element-ui时,有时候想要修改组件内的样式,但不成功,例如 <div class="test"> <el-button>按钮</e ...
- leetcode解题报告(3):Search in Rotated Sorted Array
描述 Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 m ...
- Noip2001 提高组 T3
T3 题目描述 给出一个长度不超过200的由小写英文字母组成的字母串(约定;该字串以每行20个字母的方式输入,且保证每行一定为20个).要求将此字母串分成k份(1<k<=40),且每份中包 ...