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 8239379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:07:37+00:00 2026-06-07T20:07:37+00:00

I am a newbie at Spring 3.1 MVC, and I need some help. I

  • 0

I am a newbie at Spring 3.1 MVC, and I need some help. I must be missing something, but I can’t figure out what. And yes, I’ve done Google searches for tutorials. I am simply trying to call a JSP for the first time, and I get this.

SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'comment' 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.LabelTag.autogenerateFor(LabelTag.java:129)
    at org.springframework.web.servlet.tags.form.LabelTag.resolveFor(LabelTag.java:119)
    at org.springframework.web.servlet.tags.form.LabelTag.writeTagContent(LabelTag.java:89)
    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.GuestBook_jsp._jspx_meth_form_005flabel_005f0(GuestBook_jsp.java:271)
    at org.apache.jsp.GuestBook_jsp._jspx_meth_form_005fform_005f0(GuestBook_jsp.java:216)
    at org.apache.jsp.GuestBook_jsp._jspService(GuestBook_jsp.java:127)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)

Here is the form in my JSP.

<form:form method="post" action="GuestBook.jsp" modelAttribute="comment">
    <table>
        <tr>
            <td><form:label path="comment.name">Name</form:label></td>
            <td><form:input path="comment.name" /></td>
        </tr>
        <tr>
            <td><form:label path="comment.message">Message</form:label></td>
            <td><form:textarea path="comment.message" rows="10" cols="50" /></td>
        </tr>
        <tr>
            <td><input type="submit" value="Submit comment" /></td>
            <td>&nbsp;</td>
        </tr>
    </table>
</form:form>

Here is my controller.

package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;

import com.dao.CommentDAO;
import com.model.Comment;

@Controller
@RequestMapping("/GuestBook.jsp")
@SessionAttributes("comment")
public class CommentController {
    Comment comment;

    public Comment getComment() {
        return comment;
    }

    public void setComment(Comment comment) {
        this.comment = comment;
    }

    @RequestMapping(value = "/addComment", method = RequestMethod.POST)
    public String addComment(@ModelAttribute("comment") Comment comment, BindingResult result) {
        CommentDAO commentDAO = new CommentDAO();
        java.util.Date today = new java.util.Date();
        java.sql.Date date = new java.sql.Date(today.getTime());
        comment.setDate(date);

        if (commentDAO.writeComment(comment) == true) {
            return "redirect:GuestBook.jsp";
        }

        return "redirect:Oops.jsp";
    }

    @RequestMapping("/showComments")
    public ModelAndView showComments() {
        return new ModelAndView("comment", "command", new Comment());
    }
}

Here is ghs1986-servlet.xml.

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>
    <bean name="comment" class="com.model.Comment" />

    <bean name="/GuestBook.jsp" class="com.controller.CommentController">
        <property name="comment" ref="comment" />
    </bean>
</beans>
  • 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-06-07T20:07:38+00:00Added an answer on June 7, 2026 at 8:07 pm

    You must add bean to a model in controller method that is responsible for feeding data into form.

    Just add model as method param and then in body, add empty comment bean to a model

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

Sidebar

Related Questions

I'm a newbie in Spring Batch, and I would appreciate some help to resolve
I am a newbie with Spring MVC but I'm quite impressed with its capabilities.
I'm a newbie in ASP.net MVC 3. I'm trying to do something trivial, but
Is there some easy to follow tutorial for a Spring MVC newbie to add
this is a really newbie question: How can I output XML with Spring MVC,
I am newbie in spring. using spring 3.0 mvc. I am creating a spring
Hi i am newbie to Spring. While i was writing some sample application using
I'm a Spring newbie, I'm following some examples from books and tutorials in the
I'm a newbie on Spring-Batch and I want to use it to batch some
I'm a newbie at MVC / Razor and I need a bit of direction.

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.