Blaze Blaze - 5 months ago 59
Java Question

Bean property 'xxxx is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter

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?

Answer

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">
Comments