问题原因:在 @Valid 的那个参数后面紧跟着一个 BindingResult 的参数(一定要紧跟着)

参考来源:https://segmentfault.com/q/1010000008384686

正确的参数签名

    @PostMapping("publishPost.do")
public String publishPost(@Valid @ModelAttribute Post post,
BindingResult bindingResult,
Errors errors, Model model, Integer tid,String action, RedirectAttributes attributes) {

错误的签名

//发帖
@PostMapping("publishPost.do")
public String publishPost(@Valid @ModelAttribute Post post,Integer tid,
BindingResult bindingResult,
Errors errors, Model model, String action, RedirectAttributes attributes) {

spring 使用@Valid校验数据出错DEBUG org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod - Failed to resolve argument 0 of type的更多相关文章

  1. eclipse里面配置spring,提示java.lang.ClassNotFoundException:org.springframework.web.servlet.Dispatcher错误

    在eclipse里面创建了一个Dynamic 项目,用到spring,一直提示java.lang.ClassNotFoundException: org.springframework.web.ser ...

  2. transaction 用tx事务 测试时 报错:Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/mvc]

    Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/sc ...

  3. spring:org.springframework.web.servlet.DispatcherServlet noHandlerFound解决方法

    1.搜了许久: <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern& ...

  4. Spring 整合hibernante 错误java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    1.将所需的jar包全部拷贝到WEB-INF/lib下,再重新启动tomcat便能顺利通过了.参考http://blessht.iteye.com/blog/1104450 最佳答案   spring ...

  5. idea/ecipse中使用maven集成springmvc相关jar包时候,出错:java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

    参考stackoverflow:https://stackoverflow.com/questions/11227395/java-lang-classnotfoundexception-org-sp ...

  6. spring的困惑--org.springframework.web.servlet.DispatcherServlet noHandlerFound

    出现这种情况可能是代码没有更新到Tomcat服务器上

  7. 【spring 注解 错误】使用controller 作为后台给前台ajax交互数据出错

    controller作为后台与前台的ajax进行交互,后台的方法处理完成返回一个boolean类型的值,想传给前台用来判断是否执行成功,BUT,问题来了: 严重: Servlet.service() ...

  8. Spring 4 官方文档学习(十一)Web MVC 框架

    介绍Spring Web MVC 框架 Spring Web MVC的特性 其他MVC实现的可插拔性 DispatcherServlet 在WebApplicationContext中的特殊的bean ...

  9. Spring使用mutipartFile上传文件报错【Failed to instantiate [org.springframework.web.multipart.MultipartFile]】

    报错场景: 使用SSM框架实现文件上传时报“Failed to instantiate [org.springframework.web.multipart.MultipartFile]”错,控制器源 ...

随机推荐

  1. OpenGL学习脚印: uniform blocks在着色器中的使用 转自https://blog.csdn.net/wangdingqiaoit/article/details/52717963

    写在前面 目前,我们在着色器中要传递多个uniform变量时,总是使用多个uniform,然后在主程序中设置这些变量的值:同时如果要在多个shader之间共享变量,例如投影矩阵projection和视 ...

  2. nomn文件分析

    #encoding=gbk import os import re import math from os import path ''' 手动输入文件nmon文件路径,要截取的开始时间,结束时间 ' ...

  3. Oracle中统计block空闲情况的一个SQL语句

    此SQL来自网络,地址见具体内容.介绍表空间回收原理的文章参考此链接: https://oracle-base.com/articles/misc/reclaiming-unused-space#sh ...

  4. P1038 神经网络[拓扑]

    题目背景 人工神经网络(Artificial Neural Network)是一种新兴的具有自我学习能力的计算系统,在模式识别.函数逼近及贷款风险评估等诸多领域有广泛的应用.对神经网络的研究一直是当今 ...

  5. JDK源码那些事儿之常用的ArrayList

    前面已经讲解集合中的HashMap并且也对其中使用的红黑树结构做了对应的说明,这次就来看下简单一些的另一个集合类,也是日常经常使用到的ArrayList,整体来说,算是比较好理解的集合了,一起来看下 ...

  6. Property or method "openPageOffice" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by

    Property or method "openPageOffice" is not defined on the instance but referenced during r ...

  7. this绑定问题

    this是属性和方法“当前”(运行时)所在的对象.this是函数调用时发生的绑定,它的值只取决于调用位置(箭头函数除外). 函数调用的时候会产生一个执行上下文,this是对这个执行上下文的记录. ❌误 ...

  8. chrome扩展开发实战入门之二-自动搜索

    目标:产生随机数,用于百度搜索:像看电视一样观看搜索结果 参考上一篇,新建目录hellocrx,其中三个文件:manifest.json  content_script.js 和jquery-3.4. ...

  9. [Luogu] 跑路

    https://www.luogu.org/problemnew/show/P1613 Floyd判断是否一步到达 将一步到达的连变跑Floyd #include <iostream> # ...

  10. 费马小定理 x

    费马小定理(Fermat Theory) 是数论中的一个重要定理,其内容为: 假如p是质数,且gcd(a,p)=1,那么 a(p-1)≡1(mod p).即:假如a是整数,p是质数,且a,p互质(即两 ...