0
votes

Why am I getting this error even when everything seems fine

this is the code in my index.jsp code

<body>
        <center><h1>SERVICE</h1>
            <h2>Enter Service Details</h2>
        <form:form method="POST" commandName="servDetForm" action="AddService">
              <table style="appearance:dialog ">

                    <tr>
                        <td>Number</td>
                        <td><form:input path="xxx"/></td>
                    </tr>
                    <tr>
                        <td>Number</td>
                        <td><form:input path="xxx"/></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><form:button name="addService" value="Add Service">Add Service</form:button></td>

                    </tr>
                </table>
           </form:form>
            </center>
      </body>

where is my wrong?

1
If that is the model object, then that isn't the model object that is being used by the form. Post your controller as well.M. Deinum
controller code addedBlaze
Well how about you show us the actual code, because the actual problem is likely to be a typo in your actual code that you have not reproduced in the question!Stephen C
I agree with @StephenC copy paste the real code because this is pretty useless...steelshark
Add your model (not only the getters/setters) and the full code for the form (not only the fields). Also if this is pseudo code instead of your real code, then it it quite hard to help you.M. Deinum

1 Answers

1
votes

You are sending a wrong instance to the view.

@RequestMapping(value="/index", method=RequestMethod.GET)
public ModelAndView indexView(){
    return new ModelAndView("index","servDetForm",new ServiceTb());
}

Also in your Bean need to use camelCase notation not snakecase. camelcase vs snakecase the explanation

Should be ItasTb entity

Change your JSP to:

<form:form method="POST" modelAttribute="servDetForm">