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 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 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 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
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 
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 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
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 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
How can you handle form in Spring 3.2 MVC?
How can you handle form in
Spring 3.2
MVC? Hi,
How can you handle... the
How can you handle form in
Spring 3.2
MVC?
Hi,
This article....
For more please visit the
How can you handle form in
Spring 3.2
MVC
Spring MVC Tutorials
;
Spring 3 MVC Login Form Example - In this tutorial
you will learn
how....
Spring 3 MVC and Hibernate
3 Example - Learn
how... about the modules of the framework.
Spring 3 MVC
Spring 3 MVC Login Form Example
Spring 3 MVC Login Form Example
In this tutorials we are showing you...;title>
Spring
3,
MVC Examples</title>
</head>
<body>
<h1>
Spring
3,
MVC Examples</h1>
<ul>
<li>
Spring 3 MVC Registration Form Example
Spring 3 MVC Registration Form Example
In this tutorial we are create...;>
<title>
Spring
3,
MVC Examples</title>
</head>
<body>
<h1>
Spring
3,
MVC Examples</h1>
<ul>
Spring MVC Say Hello Example
with the development of
form based application in
Spring MVC. You will learn
how... Say Hello application in
Spring 2.5
MVC
 ... the
spring tag library and other
is <taglib-location> tag that told us where
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>
<
quartz schedular in spring mvc
quartz schedular in
spring mvc
how to apply auto emailing through sping
mvc and want to pass some variable to that trigger job
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