这两天在做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. C#操作IE

    操作IE主要使用两个Com Dll: 1.Microsoft Internet Controls 2.Microsoft HTML Object Library 使用Microsoft Interne ...

  2. 89c52串口发送接收小示例

    //串口发送 void sendChar(char *p)//调用前关中断,调用完成后关中断 { while(*p != '\0') { SBUF = *P while(!TI); TI = 0; p ...

  3. 系统简单的UIImagePickerController

    1.从系统相册中读取 /* 判断选择的读取类型是否支持 UIImagePickerControllerSourceTypePhotoLibrary,普通相册 UIImagePickerControll ...

  4. 原创+部分引用啦:C# Winform界面中的分隔线问题

    C sharp 中Winform中的控件很多,一个小小的问题居然会绕上一个小弯子,做界面的时候, 你需要在界面上弄一条分隔线,把相关的功能分隔开来,结果原来在其它 IDE编辑器里很容易实现的这个功能, ...

  5. 轻量级jquery框架之--面板(panel)

    面板需求: (1)支持可拖拽,面板将作为后期的布局组件.window组件.alert组件的基础. (2)支持自定义工具栏,工具栏位置定义在面板底部,工具栏依赖toolbar组件. (3)支持加载JSO ...

  6. python 连接Mysql数据库

    1.下载http://dev.mysql.com/downloads/connector/python/ 由于Python安装的是3.4,所以需要下载下面的mysql-connector-python ...

  7. linux io优化

    场景:xml文件解析入库:并备份 问题:磁盘io异常,经常100%busy: linux io优化方法: 1.修改磁盘挂着参数,修改为writeback模式:对于文件读取频繁的可以设置noatime: ...

  8. LFS,编译自己的Linux系统 - 准备

    概述 现在用的操作系统是Win8.1,用VMware创建一个虚拟机,3G内存(物理内存是6G,分一半),23G硬盘,其中3G用于swap分区,10G用于host system,10G用于建立LFS系统 ...

  9. JS编码解码详解

    今天在整理 js编码解码方法时,在网上搜资料,发现一篇文章讲的不错,讲解的非常简单明了,于是乎就想转载过来,却发现无法转载到博客园,最后只能卑鄙的摘抄过来.js编码解码就是将一些对URL和数据库敏感的 ...

  10. 观点:哪些人适合做FPGA开发?(转)

    原文:http://xilinx.eetrend.com/blog/561 FPGA目前非常火,各个高校也开了FPGA的课程,但是FPGA并不是每个人都适合,FPGA讲究的是一个入道,入什么道,入电子 ...