My User.hbm file is like this ,
<composite-id>
<key-property name="username" type="java.lang.String">
<column name="USERNAME"></column>
</key-property>
<key-property nam开发者_高级运维e="location" type="java.lang.String">
<column name="LOCATION"></column>
</key-property>
</composite-id>
User class is like this,
private String username;
private String location;
getter and setter I have overridden hashcode and equals method.
In my mvc form controller i am trying to display user related data
My jsp page
<div>
<appfuse:label key="user.name" styleClass="desc"/>
<form:input path="username" id="tag" cssClass="text medium" cssErrorClass="text medium error"/>
</div>
My form controller.class
@RequestMapping(method = RequestMethod.POST)
public String onSubmit(User user, BindingResult errors,
HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("entering 'onSubmit' method ...");
/////user.getUsername
}
After i submit by form data , is getting added to the username
If i try to print user.getUsername it print name with , eg :,hello.
Can any one please explain why this happens how to solve it.? Is it related to composite id?
I think you need to create inner static class which should be mapped as Composite Id.
Mapping same class relation
Mapping same class relation - continuation
Please look at this questions and answers it may help.
thanks i solved the issue.In hidden path i was using
<form:hidden path="userName"/>
<div>
<appfuse:label key="user.name" styleClass="desc"/>
<form:input path="username" id="tag" cssClass="text medium" cssErrorClass="text medium error"/>
</div>
i removed hidden it solved issue
精彩评论