1.就拿简单的登录来说吧,这是开始的代码

@RequestMapping(value="/login")
public ModelAndView login(@RequestParam(“loginname”) String loginname,
@RequestParam("password") String password,
HttpSession session,
ModelAndView mv){
// 调用业务逻辑组件判断用户是否可以登录
User user = hrmService.login(loginname, password);
if(user != null){
// 将用户保存到HttpSession当中
session.setAttribute(HrmConstants.USER_SESSION, user);
// 客户端跳转到main页面
mv.setViewName("redirect:/main");
}else{
// 设置登录失败提示信息
mv.addObject("message", "登录名或密码错误!请重新输入");
// 服务器内部跳转到登录页面
mv.setViewName("forward:/loginForm");
}
return mv;

}

在浏览器中输入localhost:8080/xxx/login,爆出了400,Required String parameter 'paramter' is not present。

2.controller类中,在注解@RequestParam,添加value="paramter",required=false.切记,是false.就OK了。

@RequestMapping(value="/login")
public ModelAndView login(@RequestParam(value="loginname",required=false) String loginname,
@RequestParam(value="password",required=false) String password,
HttpSession session,
ModelAndView mv){
// 调用业务逻辑组件判断用户是否可以登录
User user = hrmService.login(loginname, password);
if(user != null){
// 将用户保存到HttpSession当中
session.setAttribute(HrmConstants.USER_SESSION, user);
// 客户端跳转到main页面
mv.setViewName("redirect:/main");
}else{
// 设置登录失败提示信息
mv.addObject("message", "登录名或密码错误!请重新输入");
// 服务器内部跳转到登录页面
mv.setViewName("forward:/loginForm");
}
return mv;

}

跳转成功。

400错误,Required String parameter 'paramter' is not present的更多相关文章

  1. HTTP Status 400 - Required String parameter 'userName' is not present 错误

    HTTP Status 400 - Required String parameter 'userName' is not present 错误 先mark  有时间详细写 参考链接: https:/ ...

  2. Jpa 报错 :HTTP Status 400 - Required String parameter 'xx' is not present

    一.问题描述 使用Springboot JPA 做分页查询,报错Required String parameter 'xx' is not present,后端未接受到请求 二.解决方案: 使用的请求 ...

  3. required string parameter 'XXX'is not present 的几种情况

    required string parameter 'XXX'is not present 的几种情况 情况一:原因是由于头文件类型不对,可以在MediaType中选择合适的类型,例如GET和POST ...

  4. required string parameter XXX is not present

    @RequestParam jQuery调用方式: deleteFile: function(filePath) { return ajax({ method: 'POST', url: '/cm/s ...

  5. org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'xxxx' is not present

    org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'xxx ...

  6. 后台接收参数报错 Required String parameter 'id' is not present

    来自:https://blog.csdn.net/qq_15238647/article/details/81539287 关于ajax请求spring后台出现 Required String par ...

  7. 报错:required string parameter XXX is not present

    报错:required string parameter XXX is not present 不同工具发起的get/delete请求,大多数不支持@RequestParam,只支持@PathVari ...

  8. Springboot 错误信息:Required String parameter 'loginname' is not present 引发的研究

    @PostMapping("/reg/change")public CommonSdo change( @RequestParam(value = "oldPasswor ...

  9. Required String parameter 'images' is not present

    后台控制层控制为非必填即可: @RequestMapping("/addDo") @SJson @SLog(description = "Car_main") ...

随机推荐

  1. Linux中断 - IRQ number和中断描述符

    一.前言 本文主要围绕IRQ number和中断描述符(interrupt descriptor)这两个概念描述通用中断处理过程.第二章主要描述基本概念,包括什么是IRQ number,什么是中断描述 ...

  2. codeforces#254DIV2解题报告

    今天简直大爆发啊... 吃了顿烧烤竟然这么管事. . . .. 本弱渣竟然做出来了3道,并且B题是我第一次在CF中用到算法..(曾经最多也就是贪心. . . ). 题目地址:codeforces#22 ...

  3. Python isnumeric() 方法

    描述 Python isnumeric() 方法检测字符串是否只由数字组成.这种方法是只针对unicode对象. 注:定义一个字符串为Unicode,只需要在字符串前添加 'u' 前缀即可,具体可以查 ...

  4. SQL批量删除用户表(先删除所有外键约束,再删除所有表)

    --批量删除用户表 --1.删除外键约束DECLARE c1 cursor for     select 'alter table ['+ object_name(parent_obj) + '] d ...

  5. jquery.dataTables的用法

    写页面前端时,使用表格的插件可以快速漂亮的排版.本例子中使用jquery.dataTables来处理table.直接来点干货 html代码如下 <table cellpadding=" ...

  6. JavaScript Interview Questions: Event Delegation and This

    David Posin helps you land that next programming position by understanding important JavaScript fund ...

  7. 解决:IIS APPPOOL\DefaultAppPool 登录失败的问题

    为大家介绍下解决IIS APPPOOL\DefaultAppPool 登录失败的方法,有遇到类似问题的朋友参考下. 添加ASP.NET网站时,选择添加"添加应用程序"连接sql s ...

  8. 将一个4X4的数组进行逆时针旋转90度后输出,要求原数组数据随机输入

    //将一个4X4的数组进行逆时针旋转90度后输出,要求原数组数据随机输入 #include<stdio.h> int main() { int a[4][4],b[4][4],i,j;// ...

  9. C#修改GIF大小同时保持GIF仍然可动和背景透明

    /// <summary> /// 设置GIF大小 /// </summary> /// <param name="path">图片路径< ...

  10. Python asyncio文档阅读摘要

    文档地址:https://docs.python.org/3/library/asyncio.html 文档第一句话说得很明白,asyncio是单线程并发,这种event loop架构是很多新型异步并 ...