文档章节

springMVC报错 Neither BindingResult nor plain ta....

philonic
 philonic
发布于 2016/01/12 12:05
字数 501
阅读 458
收藏 0

tomcat报错如下:

2016-01-12 11:41:39,238 ERROR [web.servlet.tags.form.InputTag] - Neither BindingResult nor plain target object for bean name 'mlisBasicinfo' available as request attribute

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'mlisBasicinfo' available as request attribute

at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:144)

at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168)

at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188)

at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:154)

at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:141)

at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:132)

at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:116)

at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:422)

at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142)

at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84)

at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)

at org.apache.jsp.business.modules.database.mlisBasicinfoList_jsp._jspx_meth_form_005finput_005f0(mlisBasicinfoList_jsp.java:488)

at org.apache.jsp.business.modules.database.mlisBasicinfoList_jsp._jspService(mlisBasicinfoList_jsp.java:226)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)

at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)

at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)

at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)

at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)

at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)

at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)

at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)

at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)

at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)

at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)

at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Unknown Source)

一月 12, 2016 11:41:39 上午 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet [jsp] in context with path [/ycinfo] threw exception [An exception occurred processing JSP page /business/modules/database/mlisBasicinfoList.jsp at line 78


75:     <form:form id="searchForm" modelAttribute="mlisBasicinfo" action="" method="post" class="breadcrumb form-search">

76:         <ul class="ul-form">

77:             <li><label>参数名称:</label>

78:                 <form:input path="basicinfoName" htmlEscape="false" maxlength="64" class="input-xlarge"/>

79:             </li>

80:             <li><label>参数类型:</label>

81:                 <form:select path="basicinfoType" class="input-xlarge">



Stacktrace:] with root cause

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'mlisBasicinfo' available as request attribute

原因:form表单中的modelAttribute="mlisBasicinfo" 无法获取到,加载页面是直接到jsp页面,没有modelAttribute,

解决:先经过controller类,再到jsp页面的,可在controller类中添加@ModelAttribute 的get方法


@ModelAttribute

    public MlisBasicinfo get(@RequestParam(required = false) String id) {

        MlisBasicinfo entity = null;

        if (StringUtils.isNotBlank(id)) {

            entity = mlisBasicinfoService.get(id);

        }

        if (entity == null) {

            entity = new MlisBasicinfo();

        }

        return entity;

    }


© 著作权归作者所有

共有 人打赏支持
philonic

philonic

粉丝 4
博文 33
码字总数 70879
作品 0
程序员
加载中

评论(1)

philonic
philonic
http://www.cnblogs.com/zhaoyang/archive/2012/01/07/2315403.html
springmvc 数据绑定 validate

springmvc数据绑定,做验证时,方式应该如下写: public String add(@Valid User user,BindingResult binding),里面要有处理验证结果的BindResult如果没有加,像如下这样: public String ...

菠萝啊哈哈
2014/07/09
0
0
Spring MVC的@RequestMapping注解的方法签名异常

病理特征:Errors/BindingResult argument declared without preceding model attribute. Check your handler method signature 堆栈信息:忘了^_^... 自从使用Spring框架以后,笔者再也没有用......

李长春
2011/09/15
0
1
【补充】Hibernate validator使用和自定义validator及整合Spring MVC

Hibernate validator使用 导入validation-api-xxx.jar 以及 hibernate-validator-xxx.Final.jar 需要检查的java bean Entity.java 值校验的测试类 输出结果 这里有一个国际化的key值,国际化文...

jason_wu_2
2016/12/27
387
0
使用SpringMVC的@Validated注解验证

1、SpringMVC验证@Validated的使用 第一步:编写国际化消息资源文件 编写国际化消息资源ValidatedMessage.properties文件主要是用来显示错误的消息定制 [java] view plain copy edit.userna...

瑟青豆
06/22
0
0
在springmvc中commons validator验证框架

现在我已经配置好了但是一直说标签里面的user找不到 这是控制器代码 package com.kjt; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; i...

wuyuehang
2015/05/29
1K
2

没有更多内容

加载失败,请刷新页面

加载更多

python: 一些关于元组的碎碎念

初始化元组的时候,尤其是元组里面只有一个元素的时候,会出现一些很蛋疼的情况: def checkContentAndType(obj): print(obj) print(type(obj))if __name__=="__main__": tu...

Oh_really
昨天
1
2
jvm crash分析工具

介绍一款非常好用的jvm crash分析工具,当jvm挂掉时,会产生hs_err_pid.log。里面记录了jvm当时的运行状态以及错误信息,但是内容量比较庞大,不好分析。所以我们要借助工具来帮我们。 Cras...

xpbob
昨天
51
0
Qt编写自定义控件属性设计器

以前做.NET开发中,.NET直接就集成了属性设计器,VS不愧是宇宙第一IDE,你能够想到的都给你封装好了,用起来不要太爽!因为项目需要自从全面转Qt开发已经6年有余,在工业控制领域,有一些应用...

飞扬青云
昨天
1
0
我为什么用GO语言来做区块链?

Go语言现在常常被用来做去中心化系统(decentralised system)。其他类型的公司也都把Go用在产品的核心模块中,并且它在网站开发中也占据了一席之地。 我们在决定做Karachain的时候,考量(b...

HiBlock
昨天
1
0
大数据学习脑图以及入门教程!

近些年,大数据的火热可谓是技术人都知道啊,很多人呢,也想学习大数据相关,所以,这里分享几个大数据脑图,希望可以让你清楚明白从哪里入门大数据,知道该学习以及掌握哪些知识点; 大数据...

董黎明
昨天
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部