You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@yahoo.com> on 2001/07/31 23:15:00 UTC

Data Object and Calendar

I have a Data Object (DO) that we use to throw b/w our EJBs and forms.  

1.  In one particular DO, I am using the Gregorian Calendar to set day, month
and year.  
2.  I am using the validation framework to validate that day is b/w 1-31, that
month is b/w 1-12 and year is b/w 2001 and 2100.  

The validation framework is not validating day or month, because with the
gregorian calendar in my getters/setters - you can set a day or a month to any
number and it will simply increment the calendar.

Does anyone know of a way to get around this?  I'd like to NOT use Javascript,
but I want to validate the value the user entered, rather than the value from
the DO using getValue();

Thanks,

Matt

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Re: Data Object and Calendar

Posted by David Winterfeldt <dw...@yahoo.com>.
Do you have setLenient(false) on the GregorianCalendar
class?  It should reject inappropriate dates then.  I
don't know why it doesn't default to this behavior.

David

--- Matt Raible <ma...@yahoo.com> wrote:
> I have a Data Object (DO) that we use to throw b/w
> our EJBs and forms.  
> 
> 1.  In one particular DO, I am using the Gregorian
> Calendar to set day, month
> and year.  
> 2.  I am using the validation framework to validate
> that day is b/w 1-31, that
> month is b/w 1-12 and year is b/w 2001 and 2100.  
> 
> The validation framework is not validating day or
> month, because with the
> gregorian calendar in my getters/setters - you can
> set a day or a month to any
> number and it will simply increment the calendar.
> 
> Does anyone know of a way to get around this?  I'd
> like to NOT use Javascript,
> but I want to validate the value the user entered,
> rather than the value from
> the DO using getValue();
> 
> Thanks,
> 
> Matt
> 
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute
> with Yahoo! Messenger
> http://phonecard.yahoo.com/


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/