Spring MVC - Failed to Convert Property Value of Type 'Java.Lang.String' to Required Type 'Java.Lang.Integer'

Spring MVC - Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Integer'

The problem is that value 9962287970 is out of range for type Integer.

Integer.MAX_VALUE < 9962287970 

To fix this change private Integer phone; to private Long phone; OR private String phone;

If you use String you can store other chars like + to the variable phone.

refer http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

The defauld value of int is 0 but for Integer it is not zero since it a object, so you have to initialize the value to 0;

Failed to convert property value of type 'java.lang.String' to required type '[]'

Inside jumuiya_michango_form.html you have a select

Please change that to name="kandaMchango.id", because you actually want to map the value of the selected option to the id of the kandaMchango object.

Failed to convert property value of type 'java.lang.String'

Your problem is that in your select says the field is a role, entity type Role, but in your options the value is an ID, some primitive value, then doesnt match. You can change to this

<select th:field="*{role.id}">
<option value="#" disabled = "disabled" selected="selected">Role...</option>
<option th:each="r : ${roles}" th:value="${r.id}" th:text="${r.name}">Developer</option>
</select>

Failed to convert property value of type java.lang.String to required type long for property phone; nested exce

Try to use Long instead of long.

Because long can never be null it is not primitive type.

So you should use Long.



Related Topics



Leave a reply



Submit