这两天在做spring3.0 MVC+hibernate3.2的练习中,做简单的form提交,
一直报java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute
查了好多资料都没有办法解决(有可能是报的错误一样却引起的原因不一样吧),最后还是发现自己在jsp的form标签上写少了commandName属性,
后来加上就可以了。
报错时的代码:<form:form method="post" action="addContact.html">
修正后的代码:<form:form method="post" action="addContact.html" commandName="contact"> Spring给我们提供了一个commandName属性,我们可以通过该属性来指定我们将使用Model中的哪个属性作为form需要绑定的command对象。
除了commandName属性外,指定modelAttribute属性也可以达到相同的效果。 

spring MVC做form提交Neither BindingResult nor plain target object for bean name 'command' available的更多相关文章

  1. Neither BindingResult nor plain target object for bean name 'command' available as request attribute

    最近用JSR303在表单提交时使用Java Bean Validation验证数据.报错堆栈如下: java.lang.IllegalStateException: Neither BindingRe ...

  2. 异常:Neither BindingResult nor plain target object for bean name 'command' available as request attribute

    Neither BindingResult nor plain target object for bean name 'command' available as request attribute ...

  3. Neither BindingResult nor plain target object for bean

    当你开发一个项目,如果你选择的是spring MVC 框架,而你在前台使用spring的标签时,那么你有可能出现在这个情况. javax.servlet.jsp.JspTagException: Ne ...

  4. 当使用Spring MVC @Valid对输入框进行验证的时候,可能会遇到以下的异常:Neither BindingResult nor plain target object for bean name ‘mybean’ available as request attribute

    转自:https://www.cnblogs.com/wenhulu/p/5555457.html 当使用Spring MVC @Valid对输入框进行验证的时候,可能会遇到以下的异常: Neithe ...

  5. [springMVC]javax.servlet.jsp.JspTagException: Neither BindingResult nor plain target object for bean

    问题描述: 页面使用标签<form:form>进行提交时,出现[springMVC]javax.servlet.jsp.JspTagException: Neither BindingRe ...

  6. SpringMVC java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name

    当跳转到一个含有form表单的页面的时候 如<form:form commandName="useCarInfo" 必须要new一个useCarInfo的同名实例给jsp来接 ...

  7. javax.servlet.jsp.JspTagException: Neither BindingResult nor plain target object for bean (蛋疼死我了)

    1为抛出异常原因,2为异常解决方法. 原因:   进入spring:bind标签源码你可以看到 Object target = requestContext.getModelObject(beanNa ...

  8. Neither BindingResult nor plain target object for bean name 'user' available as request attribute

    这个异常是因为jsp页面写错了. 把<form:form></form:form>标签改成普通的标签即可. 应该是第一次访问的时候,user是空的.但springmvc不能是空 ...

  9. java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'user'

    转自: https://blog.csdn.net/Winter_chen001/article/details/77332944

随机推荐

  1. [置顶] Java中发邮件的6种方法

    1.官方标准JavaMail Sun(Oracle)官方标准,功能强大,用起来比较繁琐. 官方资料:http://www.oracle.com/technetwork/java/javamail/in ...

  2. poj1036-dp

    http://poj.org/problem?id=1036 题目分析: 由题目很容易就能想到这道题目是DP题目. 当然,它的DP方程也不难得到: 定义状态:d[i,j] 表示在时间t=i且门状态为j ...

  3. Git 上传本地命令

    1.首先建立一个文件夹用以测试 2.在test中写入一个main.c的文件 其内容如下: 3.然后就建立一个git仓库了 4.然后就是把内容加进去了,上传上去 5.然后我们看下git log的信息 6 ...

  4. vue 单页面应用实战

    1. 为什么要 SPA? SPA: 就是俗称的单页应用(Single Page Web Application). 在移动端,特别是 hybrid 方式的H5应用中,性能问题一直是痛点. 使用 SPA ...

  5. javascript版1024游戏源码

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  6. IT学习方法

    IT 技术的发展日新月异,新技术层出不穷,具有良好的学习能力,能及时获取新知识.随时补充和丰富自己,已成为程序员职业发展的核心竞争力.本文中,作者结合多年的学习经验总结出了提高程序员学习能力的三个要点 ...

  7. struts2 实现过程和xml配置

    实现过程: 当Web容器收到 请求(HttpServletRequest)它将请求传递给一个标准的的过滤链包括 (ActionContextCleanUp)过滤器,然后经过Other filters( ...

  8. OpenCV——IplImage

    IplImage结构: typedef struct _IplImage { int nSize; /* IplImage大小 */ int ID; /* 版本 (=0)*/ int nChannel ...

  9. c中关于#与##的简易使用

    #运算符用于在预编译时,将宏参数转换为字符串 eg. #include <stdio.h>#define CONVERT(f)(#f) void helloworld(){ printf( ...

  10. set up size, title to tcl tk main window

    #!/usr/bin/wish wm title . "this is main title" wm geometry . 500x300+30+200 500 --width 3 ...