How to customize property type conversion errors in Spring MVC 3.
Hi,
I have readed "Spring 3 MVC Validation Example" http://www.roseindia.net/tutorial/spring/spring3/web/spring-3-mvc-validation-example.html.
In the validation form example, I have populated age's imput with a string "hello". After send the form, I receive a type conversion error:
Failed to convert property value of type java.lang.String to required type java.lang.Integer for property age; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value "hello" from type java.lang.String to type java.lang.Integer; nested exception is java.lang.IllegalArgumentException: Unable to parse hello
Is it possible to customize this error message? I'd like to say something user-friendly.
Thanks in advance,
ATV.
View Answers
February 10, 2011 at 5:57 PM
February 10, 2011 at 6:12 PM
Hi,
According to http://stackoverflow.com/questions/4082924/jsr-303-type-checking-before-binding/4083198#4083198 I have modified message properties in order to add the follows:
typeMismatch=A numeric value was expected!
Thanks.
ATV
Ads
Related Tutorials/Questions & Answers:
School Timetable System in java spring mvc 3
School Timetable System in java
spring mvc 3 I want to do project in timetable generation for my project. but i dont know
how generate. i'm using java
spring Hibernate. please some one help me.
Thanks
thuva
Advertisements
Spring 3 MVC Login Form Example
Spring 3 MVC Login Form Example
Spring 3 MVC Login Form Example...());
}
My question is that, using above code
how WEB-INF/views/simpleForm.jsp page...);
}
"
how WEB-INF/views/formoutput.jsp page is called?? please help me
Spring 3 MVC Login Form Example
Spring 3 MVC Login Form Example
Spring 3 MVC Login Form Example...());
}
My question is that, using above code
how WEB-INF/views/simpleForm.jsp page...);
}
"
how WEB-INF/views/formoutput.jsp page is called?? please help me
Spring 3 MVC and Hibernate 3 Example Part 3
;text/html;
charset=ISO-8859-1">
<title>
Spring
3 MVC...;/head>
<body>
<h1>
Spring
3 MVC and Hibernate
3...;}
}
ArticleController.java
This is the
spring controller class which handles the request
Spring 3 MVC and Hibernate 3 Example Part 1
Spring 3 MVC and Hibernate
3 Example application using Annotations
This tutorial explains
how to use annotations with
spring 3 MVC and hibernate
3 based... be aware of
how spring is configured in web.xml. Here is the web.xml
we configured
Spring 3 MVC and Hibernate 3 Example Part 2
://www.springframework.org/schema/tx/
spring-tx-3.0.xsd">
<context:
property...dispatcher-servlet.xml:
<context:
property-placeholder> element specifies...:annotation-driven> element specifies
spring to look for
@Transactional beans
Spring 3 MVC Login Form Example with Database MySql
Spring 3 MVC Login Form Example with Database MySql Sir i have checked your project of
Spring 3 MVC Login Form Example
But Sir Not able to do It with database Mysql. Can you Provide code for login with database.
Thanks
How to validate form using Spring MVC?
How to validate form using
Spring MVC? Hi,
I want to validate a form in
Spring MVC using the annotation.
How to validate a form in
Spring MVC. I... to validate form using
Spring MVC?
How to use annotation for validation?
Thanks
How Spring MVC Module Works
How Spring MVC Works
How Spring MVC Works?
In this we will see the request flow for the
spring framework... of
Spring MVC module.
The
Spring MVC modules comes with the
Spring
Spring MVC
application.
Here are tutorials of
Spring MVC:
Spring MVC Tutorials
Spring 3 MVC Login Form Example
Spring 3 MVC Validation Example
Spring 3 MVC Registration...
Spring MVC Hi,
What do you understand by
Spring MVC?
Thanks
 
Spring MVC
application.
Here are tutorials of
Spring MVC:
Spring MVC Tutorials
Spring 3 MVC Login Form Example
Spring 3 MVC Validation Example
Spring 3 MVC Registration...
Spring MVC Hi,
What do you understand by
Spring MVC?
Thanks
 
Hibernate 3 Query Example Part 2
Hibernate
3 Query Example Part 2
Hibernate
3 Query Example Part 2
This tutorial explains
how to create Hibernate
3 query
example with
Spring 3 
Spring 3 MVC File Upload, Spring MVC File Upload
Spring 3 MVC File Upload
Creating file upload example using
Spring 3 MVC
Learn
how to create file upload application using
Spring MVC module of the
Spring...;
Spring
3,
MVC Examples</h1>
<ul>
<li><a
href
Data Conversion from int to another type
Data
conversion is the
conversion of data from one
type to another
type.
In this section we will learn about data
conversion from int primitive
type to another data
type like String, boolean and char etc
Data Conversion from String to another type
Data
conversion is the
conversion of data from one
type to another
type.
In this section we will learn about data
conversion from String primitive
type to another data
type like int, boolean and char etc
Data Conversion from short to another type
Data
conversion is the
conversion of data from one
type to another
type.
In this section we will learn about data
conversion from short primitive
type to another data
type like String, boolean and char etc
Data Conversion from byte to another type
Data
conversion is the
conversion of data from one
type to another
type.
In this section we will learn about data
conversion from byte primitive
type to another data
type like String, boolean and char etc
Data Conversion from float to another type
Data
conversion is the
conversion of data from one
type to another
type.
In this section we will learn about data
conversion from float primitive
type to another data
type like String, boolean and char etc
Data Conversion from double to another type
Data
conversion is the
conversion of data from one
type to another
type.
In this section we will learn about data
conversion from double primitive
type to another data
type like String, boolean and char etc
Data Conversion from long to another type
Data
conversion is the
conversion of data from one
type to another
type.
In this section we will learn about data
conversion from long primitive
type to another data
type like String, boolean and char etc
HSSFCell to String type conversion
HSSFCell to String
type conversion Hello,
Can anyone help me convert HSSFCell
type to string. There is a solution in the following URL, but the method getWorkbook() is not defined for the class HSSFCell.
Thanks in advance
Spring 2.5 MVC File Upload
Spring 2.5
MVC File Upload
Spring 2.5
MVC File Upload
This tutorial explains
how to upload file in
Spring 2.5
MVC Framework.
Spring MVC module of
Spring framework
Spring 3
Spring 3 Hi
I want to know
how to write code
Spring 3 for registration and login pages with help of data bse.Please help me I am new to
Spring
Introduction to Type conversion in Struts
Introduction to
Type conversion in Struts
Type conversion is a mechanism... this powerful and important facility.
In struts the
type conversion is an mechanism... are converted into complex bean
properties using this
type conversion mechanism
Type conversion example
Type Conversion Example
An example of
type conversion is given below, which...
invalid.fieldvalue.submissionDate=Please enter a date in yyyy-mm-dd format
Now make a
type conversion...;style
type="text/css">@import url(css/main.css);</style>
<