• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Re: Beanutils custom converter + validation

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic