-
Dec 6th, 2011, 07:33 AM
#1
problem in getSpring MVC3 getting values from the form and to load with Domine object
I am getting the below exception kindly help i got stuck up with this for a day
org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'fcode' of bean class [java.lang.String]: Bean property 'featurecode' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
My form jsp(addData.jsp)
<form:form commandName="addData" method="POST" >
<div>
<div>
<p>
<input type="text" path="fcode" >
</p>
<table width="30%" align="center">
<tr align="center">
<td><input type="button" onclick="location.href='<c:url value="/checkDataList.htm"/>'" value="Save"/></td>
</tr>
</table>
</div>
</div>
</form:form>
My Domine object:
import java.io.Serializable;
public class AddData implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private String fcode;
public String getFcode() {
return fcode;
}
public void setFcode(final String fcode) {
this.fcode = fcode;
}
My controller class details:
@RequestMapping("/checkDataList")
public String addData(
@ModelAttribute("addData") AddData addData,
BindingResult result, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String fcode = addData.getfcode();
System.out.println(fcode);
// DataService.saveData(addData);
return "redirect:/DataList.htm";
}
Last edited by swam; Dec 6th, 2011 at 07:49 AM.
-
Dec 6th, 2011, 08:30 AM
#2
Please use [ code][/code ] tags when posting code.
Use the form tags to render your input tag that will give you the proper path to do binding (it should be something like appData.fdata).
-
Dec 6th, 2011, 10:50 PM
#3
Marten thanks as adviced by i used the same
<form:form commandName="addData" method="POST" >
<div>
<div>
<p>
<form:input type="text" path="addData.fcode" >
</p>
<table width="30%" align="center">
<tr align="center">
<td><input type="button" onclick="location.href='<c:url value="/checkDataList.htm"/>'" value="Save"/></td>
</tr>
</table>
But still i am getting the same error,any other thing i need to do..?
-
Dec 7th, 2011, 02:04 AM
#4
I suggest a read of the reference guide.
path if fcode NOT addData.fcode if you use the form tags.. It is only addData.fcode if you do NOT use the form tags.
-
Dec 7th, 2011, 12:45 AM
#5
when we use location.href will be a new request rather than form submission.
so, better to use form submission.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules