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
Letting a Button Blink White to Red, Then Giving Its Old, Rounded Form
Passing Multiple Variables in @Requestbody to a Spring MVC Controller Using Ajax
Redirecting to a Servlet from a Jsp on Button Click
Spring Junit: How to Mock Autowired Component in Autowired Component
Java: How to Print Array Without Square Brackets and Commas
How to Store a String Longer Than 4000 Characters in an Oracle Database Using Java/Jdbc
Rounding to the Nearest Hundered-Thousandths
How to Split a String Between Letters and Digits (Or Between Digits and Letters)
Cannot Construct Instance of 'Java.Time.Localdate' - Spring Boot, Elasticseach, Jackson
Illegal Character When Trying to Compile Java Code
How to Make a Multipart/Form-Data Post Request Using Java
How to Call Methods Simultaneously in Java
Get Unique Values from Arraylist in Java
Regex to Replace Everything After a Specific Symbol - Java
In Java, Can You Modify a List While Iterating Through It