Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6056793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:25:00+00:00 2026-05-23T08:25:00+00:00

Implementing a simple jsr303 validation using spring 3 with annotations and I am getting

  • 0

Implementing a simple jsr303 validation using spring 3 with annotations and I am getting the following result when the post finds missing elements:

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name ‘dataForm’ available as request attribute

The controller looks like so:

@Controller
@SessionAttributes
@RequestMapping( "/dataentry.html" )
public class EnterDataController
{
  @RequestMapping( method = RequestMethod.GET )
  public String enterNewDataHandler( Map model )
  {
    DataEntryForm dataForm = new DataEntryForm();
    model.put( "dataForm", dataForm );
    return ( "dataentry" );
  }

  @RequestMapping( method = RequestMethod.POST )
  public String addData( @Valid DataEntryForm dataForm,
                           BindingResult          result,
                           Map                    model )
  {
    if ( result.hasErrors() ) { return ( "dataentry" ); }

    ... code for saving data ...
  }
}

The form looks like so:

public class DataEntryForm
{
  @NotNull
  private Double dataAmount;

  @NotNull
  @Temporal(value=TemporalType.TIMESTAMP)
  private Date dataDate;

  ... sets and gets ...
}

The jsp form section looks like so:

<form:form method="post"
           commandName="dataForm"
           action="dataentry.html">
  <table>
  <tr>
    <td><form:label path=dataAmount">Data</form:label></td>
    <td><form:input path="dataAmount"/></td>
    <td><div class="error"><form:errors path="dataAmount"/></div></td>
  </tr>
  <tr>
    <td><form:label path="dataDate">Date</form:label></td>
    <td><form:input path="dataDate"/></td>
    <td><div class="error"><form:errors path="dataDate"/></div></td>
  </tr>
  <tr>
    <td colspan="2"><input type="submit" value="Add Data"/></td>
  </tr>
</table>
</form:form>

I am implementing a standard spring return type of String for the logical view name. Here is the full stack trace:

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'dataForm' available as request attribute
org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141)
org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:174)
org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:194)
org.springframework.web.servlet.tags.form.LabelTag.autogenerateFor(LabelTag.java:129)
org.springframework.web.servlet.tags.form.LabelTag.resolveFor(LabelTag.java:119)
org.springframework.web.servlet.tags.form.LabelTag.writeTagContent(LabelTag.java:89)
org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
org.apache.jsp.WEB_002dINF.views.dataentry_jsp._jspx_meth_form_005flabel_005f0(dataentry_jsp.java:287)
org.apache.jsp.WEB_002dINF.views.dataentry_jsp._jspService(dataentry_jsp.java:114)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:927)
org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:684)
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678)
org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103)
org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96)
org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
org.apache.tiles.renderer.impl.ChainedDelegateAttributeRenderer.write(ChainedDelegateAttributeRenderer.java:76)
org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:336)
org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:210)
org.apache.tiles.template.InsertAttributeModel.end(InsertAttributeModel.java:126)
org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:311)
org.apache.jsp.WEB_002dINF.views.layout_jsp._jspx_meth_tiles_005finsertAttribute_005f3(layout_jsp.java:287)
org.apache.jsp.WEB_002dINF.views.layout_jsp._jspService(layout_jsp.java:128)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:241)
org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:222)
org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:690)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:644)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:627)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
org.springframework.web.servlet.view.tiles2.TilesView.renderMergedOutputModel(TilesView.java:124)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

Any suggestions? And, is there any docs that describe in detail what happens under the hood with this?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:25:01+00:00Added an answer on May 23, 2026 at 8:25 am

    I have had this problem before. I believe that in addition to using @Valid you must also use @ModelAttribute("dataForm") so it knows how to map your form to your DataEntryForm object.

      @RequestMapping( method = RequestMethod.POST )
      public String addData( @ModelAttribute("dataForm") @Valid DataEntryForm dataForm,
                           BindingResult          result,
                           Map                    model )
      {
          if ( result.hasErrors() ) { return ( "dataentry" ); }
    
          ... code for saving data ...
      }
    

    It looks a little ugly. I kind of wish that the two annotations could be combined somehow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am implementing a simple DHT using the Chord protocol in Java. The details
I am implementing a simple cache using LinkedHashMap based on the instructions found here
I am implementing the simple JNI example , as given in http://java.sun.com/docs/books/jni/html/start.html At the
I am implementing a simple drop-down using hiccup: ;DATASET/CREATE (defn get-cols-nms [table] This function
I am implementing a simple board game (Breakthrough) using OpenGL (plus GLUT and GLUI).
I tried implementing a simple web service into an asp.net application using the tutorial
Please consider the following code implementing a simple MixIn : class Story(object): def __init__(self,
I'm implementing a simple TCP client and TCP server in Java at the moment,
i am implementing the simple bubble sort algorithm using CUDA, and i have a
I am implementing a simple portal using jsp and struts, the user full fill

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.