• Register
0 votes
39 views

Problem :

I am very new to Spring 3's annotation and I am getting the exception.

Below is my form jsp code:

 <form:form method="POST" action="login.htm" modelAttribute="login">

  ....

  <form:input path="email" size="30" />

  ....

And following is the shameful exception I am getting whenever I try to load my landing jsp page:

SEVERE: Neither BindingResult nor plain target object for bean name 'login' available as request attribute

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'login' 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.autogenerateId(AbstractDataBoundFormElementTag.java:147)

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

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

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

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.WEB_002dINF.jsp.landing_jsp._jspx_meth_form_input_0(landing_jsp.java from :208)

at org.apache.jsp.WEB_002dINF.jsp.landing_jsp._jspx_meth_form_form_0(landing_jsp.java from :164)

at org.apache.jsp.WEB_002dINF.jsp.landing_jsp._jspService(landing_jsp.java from :107)

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

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

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

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

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

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

    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:787)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)

    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)

    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)

    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)

    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)

    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)

    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)

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

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

    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

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

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

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

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

    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

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

    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)

    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)

    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

    at java.lang.Thread.run(Thread.java:680)

6 5 3
7,540 points

1 Answer

0 votes

Solution :

To begin with you need to add the login object as an attribute of the model in the controller:

model.addAttribute("login", new Login());

Like following:

@RequestMapping(value = "/", method = RequestMethod.GET)

public String displayLogin(Model model) {

model.addAttribute("login", new Login());

return "login";

}

9 7 4
38,600 points

Related questions

0 votes
2 answers 161 views
161 views
Problem : I have created entities, services and JUnit tests for services using Spring and Hibernate for my project. All of these are working. After that I added spring-mvc to it to make this web application but while trying to make ... follows ..Could not autowire field: public pl.com.radzikowski.webmail.service.IMailManager pl.com.radzikowski.webmail.controller.HomeController.mailManager...
asked Nov 20, 2019 peterlaw 6.9k points
1 vote
1 answer 1.4K views
1.4K views
Problem : When I try to compile my spring project, I always face the below error : Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed I have the ... >1.4.1.RELEASE</version> <relativePath /> <!-- lookup parent from repository --> </parent> . . .
asked Dec 12, 2019 alecxe 7.5k points
0 votes
1 answer 37 views
37 views
Problem : For many days I am trying to create Spring CRUD application but getting following error org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean with name
asked Nov 13, 2019 peterlaw 6.9k points
0 votes
1 answer 1.6K views
1.6K views
Problem : I am trying to write Spring boot code The Program is running but I am getting following error: This application has no explicit mapping for /error, so you are seeing this as a fallback. How to fix this error?
asked Nov 22, 2019 peterlaw 6.9k points
0 votes
1 answer 3.8K views
3.8K views
Problem : I am developing the application in Spring, using a Tomcat, Mysql5, Java8... My problem is that I cannot deploy it, due to the "required bean 'entityManagerFactory' not found" problem. I have developed my project with the coworkers but ... a bean named 'entityManagerFactory' that could not be found. Action: Consider defining a bean named 'entityManagerFactory' in your configuration.
asked Jan 25 jwilliam 3.9k points