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

Spring JIRA | Stefan Ocke | 7 years ago
  1. 0

    In Roo 1.1.0.M1 [rev 684]: In create.tagx and update.tagx, the modelAttribute of the form tag is calculated like this: {code} <form:form ... modelAttribute="${fn:toLowerCase(object.class.simpleName)}"> {code} This gives wrong results for Entity names that consist of more than one "part". Consider, f.e. an Entity "FooBar". the model attribute would become "foobar" in the code above. On the other hand, the according controller would add a model attribute "fooBar" to the model map, which does not match with "foobar". This results in {code} java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'foobar' available as request attribute at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:174) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:194) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:160) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:123) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:409) at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:140) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79) at org.apache.jsp.tag.web.form.fields.input_tagx._jspx_meth_form_005finput_005f0(input_tagx.java:579) at org.apache.jsp.tag.web.form.fields.input_tagx.doTag(input_tagx.java:294) {code}

    Spring JIRA | 7 years ago | Stefan Ocke
    java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'foobar' available as request attribute
  2. 0

    In Roo 1.1.0.M1 [rev 684]: In create.tagx and update.tagx, the modelAttribute of the form tag is calculated like this: {code} <form:form ... modelAttribute="${fn:toLowerCase(object.class.simpleName)}"> {code} This gives wrong results for Entity names that consist of more than one "part". Consider, f.e. an Entity "FooBar". the model attribute would become "foobar" in the code above. On the other hand, the according controller would add a model attribute "fooBar" to the model map, which does not match with "foobar". This results in {code} java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'foobar' available as request attribute at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:174) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:194) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:160) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:123) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:409) at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:140) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79) at org.apache.jsp.tag.web.form.fields.input_tagx._jspx_meth_form_005finput_005f0(input_tagx.java:579) at org.apache.jsp.tag.web.form.fields.input_tagx.doTag(input_tagx.java:294) {code}

    Spring JIRA | 7 years ago | Stefan Ocke
    java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'foobar' available as request attribute
  3. 0

    {quote} entity --class ~.domain.FooBar field date --fieldName today --type java.util.Date --class ~.domain.FooBar controller scaffold --class ~.web.FooBarController {quote} After remove scripts from create form , and submit with invalid date pattern then you would see below exceptions: {quote} java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'foobar' available as request attribute at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:175) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:195) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:161) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:124) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:409) at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:140) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:91) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:78) ... IO Error executing tag: JSPException including path '/WEB-INF/views/foobar/create.jspx'. org.apache.tiles.util.TilesIOException: JSPException including path '/WEB-INF/views/foobar/create.jspx'. at org.apache.tiles.servlet.context.ServletUtil.wrapServletException(ServletUtil.java:232) at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:105) at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96) at org.apache.tiles.renderer.impl.UntypedAttributeRenderer.write(UntypedAttributeRenderer.java:61) at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:103) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:669) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:337) at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:234) at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:211) at org.apache.tiles.jsp.taglib.RenderTag.doEndTag(RenderTag.java:220) .... {quote} Note: Create form will work as expected after change modelAttribute in jsp and controller to 'fooBar'(not foobar).

    Spring JIRA | 7 years ago | Sid
    java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'foobar' available as request attribute
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    {quote} entity --class ~.domain.FooBar field date --fieldName today --type java.util.Date --class ~.domain.FooBar controller scaffold --class ~.web.FooBarController {quote} After remove scripts from create form , and submit with invalid date pattern then you would see below exceptions: {quote} java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'foobar' available as request attribute at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:175) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:195) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:161) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:124) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:409) at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:140) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:91) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:78) ... IO Error executing tag: JSPException including path '/WEB-INF/views/foobar/create.jspx'. org.apache.tiles.util.TilesIOException: JSPException including path '/WEB-INF/views/foobar/create.jspx'. at org.apache.tiles.servlet.context.ServletUtil.wrapServletException(ServletUtil.java:232) at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:105) at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96) at org.apache.tiles.renderer.impl.UntypedAttributeRenderer.write(UntypedAttributeRenderer.java:61) at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:103) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:669) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:337) at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:234) at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:211) at org.apache.tiles.jsp.taglib.RenderTag.doEndTag(RenderTag.java:220) .... {quote} Note: Create form will work as expected after change modelAttribute in jsp and controller to 'fooBar'(not foobar).

    Spring JIRA | 7 years ago | Sid
    java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'foobar' available as request attribute
  6. 0

    View Forum Topic

    calstatela.edu | 11 months ago
    java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'OnlineAssignment' available as request attribute

  1. abrazeneb 8 times, last 4 months ago
7 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

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

    at org.springframework.web.servlet.support.BindStatus.<init>()
  2. Spring MVC
    RequestContextAwareTag.doStartTag
    1. org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141)
    2. org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:174)
    3. org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:194)
    4. org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:160)
    5. org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:123)
    6. org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:409)
    7. org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:140)
    8. org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
    9. org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    9 frames
  3. org.apache.jsp
    input_tagx.doTag
    1. org.apache.jsp.tag.web.form.fields.input_tagx._jspx_meth_form_005finput_005f0(input_tagx.java:579)
    2. org.apache.jsp.tag.web.form.fields.input_tagx.doTag(input_tagx.java:294)
    2 frames