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

When I try to open my newReference.jsp page (to create a new reference record), it is giving me this error.
Bascially it is telling that it doesn't know the journalName from the <form:input> tag.
It complaints right from the <form:input> tag.
Any idea?

My Controller:

 @RequestMapping(value = "/addref", method = RequestMethod.GET)
    public ModelAndView addNew() {    
        ModelAndView mav = new ModelAndView("newReference");
        Referenceitem refitem = new Referenceitem();
        mav.getModelMap().put("newReference", refitem);
        return mav;

    @RequestMapping(value = "/addref", method = RequestMethod.POST)
    public String create(@ModelAttribute("newReference") Referenceitem refitem) {
        return "redirect:viewallref.htm";

My newReference.jsp page:

 <form:form ModelAttribute="newReference" method="POST" action="${saveUrl}"> 
<tr><td>Journal Name</td><td><form:input path="journalName" size="99" /></td></tr>

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
In your <form:form> tag, try using modelAttribute instead of ModelAttribute

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dkim18Author Commented:
try using modelAttribute instead of ModelAttribute???
What do you mean by that?

I also tried this and same error.
<form:form ModelAttribute="newReference" method="POST" action="${saveUrl}">
<tr><td>Journal Name</td><td><form:input path=newReference.journalName" size="99" /></td></tr
chaitu chaituCommented:
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Sorry, I thought it might be obvious. I meant the lowercase 'm'
dkim18Author Commented:
is modelAttribute case sensitive?

In my other page, I used ModelAttribute and worked fine.
I will try and get back to you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.