File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Re: Beanutils custom converter + validation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "Re: Beanutils custom converter + validation" Watch "Re: Beanutils custom converter + validation" New topic
Author

Re: Beanutils custom converter + validation

Prabhu Thopa
Greenhorn

Joined: Dec 07, 2004
Posts: 2
Hi,

I am using the beanutils converter package for performing type conversions in my formbean. I also am using a custom converter for string to date conversions. I used the example code posted by Jason Menard on this forum for my custom converter.

the code works fine provided a valid date is submitted. But if an invalid value is entered or a null (no entry) is entered and the form submitted, the converter throws a java error. Ideally, an error would not be thrown, but the user would be warned that their entry was invalid or the conversion would not be attempted for empty entries.

One way to handle this problem seems to be to use javascript to prevent invalid dates from being submitted. But if I use server side validation, i am not able to get to the validation stage because beanutils kicks in and tries to convert all request parameters for non-string fields in my formbeans and throws errors whenever it is not able to convert these fields.

Is there a way of handling this?

Thanks for your help.

Regards

Prabhu
 
 
subject: Re: Beanutils custom converter + validation
 
Threads others viewed
date conversion problem
Struts2 conversion/validation problem
digester question
Validation Problem
Struts Validator Framework Error ...Depends String is not Found in validator-rules.
IntelliJ Java IDE