Failed to convert property value of type java.lang.String to required type com.laplace.mvc.model.Role for prop
bonjour messieurs,
J'ai une classe User et une autre Role.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| @Table(name = "USERS")
public class User {
private Role role;
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
public class Role {
@Id
@Column(name = "ID")
private Integer id;
@Column(name = "NAME")
private String name;
public Role() {
//menus.size(); from Menu Where menu = null
} |
dans la page jsp
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| <spring:bind path="role">
<div class="form-group ${status.error ? 'has-error' : ''}">
<label class="col-sm-2 control-label">Role :</label>
<div class="col-sm-10">
<form:select path="role" class="form-control">
<form:option value="NONE" label="--- Select ---" />
<form:options items="${rolesList}" />
</form:select>
<form:errors path="role" class="control-label" />
</div>
</div>
</spring:bind> |
et quand je veux faire submit dans la page jsp j'ai
Citation:
Failed to convert property value of type java.lang.String to required type com.laplace.mvc.model.Role for property role; nested exception is java.lang.IllegalStateException: Cannot convert value of type java.lang.String to required type com.laplace.mvc.model.Role for property role: no matching editors or conversion strategy found