Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Spring How to customize property type conversion errors in Spring MVC 3.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


atv
How to customize property type conversion errors in Spring MVC 3.
2 Answer(s)      3 years and 9 months ago
Posted in : Spring


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.


Advertisement
View Answers

February 10, 2011 at 5:57 PM


Please visit the following link:

Spring Tutorials



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



Related Tutorials/Questions & Answers:
How to customize property type conversion errors in Spring MVC 3.
How to customize property type conversion errors in Spring MVC 3.  Hi, I have readed "Spring 3 MVC Validation Example" http://www.roseindia.net... the form, I receive a type conversion error: Failed to convert property value
Spring 3 MVC Validation Example
Spring 3 MVC Validation Example This tutorial shows you how to validate Spring 3 MVC based applications. In Spring 3 MVC annotation based controller has.../html; charset=ISO-8859-1"> <title>Spring 3, MVC
Advertisements
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
Spring 3 MVC hello world, Spring 3.0 Web MVC Example
Spring 3 MVC Hello World Example Getting stated with the Spring 3 MVC... and double click eclipse.exe. Step 3: Spring 3.0 MVC JAR files:. Following...; content="text/html; charset=ISO-8859-1"> <title>Spring 3, MVC
Spring MVC and Hibernate with DWR 3 -- Configuration Using MySQL Database
Spring MVC and Hibernate with DWR 3 -- Configuration Using MySQL Database  How to configure Spring MVC and Hibernate with DWR 3, Simple example -- reading a table, editing-deleting and adding new rows
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
Problem in Spring 3 MVC and Hibernate 3 Example tutorial source codes
Problem in Spring 3 MVC and Hibernate 3 Example tutorial source codes  I referred your tutorial "Spring 3 MVC and Hibernate 3 Example" and downloaded your source codes. I created a build.xml and built it using ant. And copied
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 do Static Resources Configuration in Spring MVC?
How to do Static Resources Configuration in Spring MVC?  Hi, I want to know How to do Static Resources Configuration in Spring MVC? thanks
Spring mvc
Spring mvc  what is spring mvc
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
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 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
Spring 3.0 MVC Form, Spring 3.0 MVC Form Example
Spring 3 MVC Form Example In this tutorial we are going to develop Spring 3... of Spring 3 MVC forms. After completing this tutorial you will be able to understand the Spring 3 MVC based applications and use the knowledge gained here
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 MVC - Spring
spring MVC  what is the use of applicationcontext.xml,[servelt-name]-servlet.xml,properties file in spring MVC module
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
How a simple "Hello World" can be displayed using Spring 3.2 MVC?
How a simple "Hello World" can be displayed using Spring 3.2 MVC?  Hi, How a simple "Hello World" can be displayed using Spring 3.2 MVC? Thanks,   Hi, I found very useful reference site for Spring 3.2 MVC Hello
Introduction to spring 3, Spring framework 3
Introduction to spring 3 In this section we will discuss about Spring 3 framework. Finally Spring 3 is here with new features and enhancements. The Spring... the components selectively. You can use IoC container of spring and any other MVC
spring MVC frame work - Spring
spring MVC frame work  Example of spring MVC frame work
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
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 3 MVC Login Form Example
Spring 3 MVC Login Form Example  In this tutorials  we are showing...; <title>Spring 3, MVC Examples</title> </head> <body> <h1>Spring 3, MVC Examples</h1> <ul>
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
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 4 MVC Hello World Example: Spring 4 MVC Tutorial will full source code
Video Tutorial of Spring 4 MVC: This video tutorial teaches you how to write.... First of you will learn Features of Spring 4 Framework and How Spring MVC... is the brief of the tutorial: Step 1: How can create spring 4 MVC application in Eclipse
Type Conversion - Java Beginners
Type Conversion   Hai, rajanikanth, Please explain how to convert from integer value to a string value .In a database operation i want to convert... for conversion
Spring MVC framework Features
This section contains the unique features of Spring MVC web framework
Spring 3, Spring 3.0, Spring Framework, Spring Framework Tutorial
Binding, and Type Conversion Spring Expression Language (SpEL) Aspect... Spring 3 Hello World Example Spring MVC Tutorials...Spring 3 In this tutorial we will learn Spring 3 Framework with the help
Advertisements
 

 

 

DMCA.com