Comparing dates

2006-12-06 Thread chamal desilva
Hi,

Is it possible to compare dates with logic equals tag.

My form bean has a property called addedDate.

I need to compare it with date 2006-12-24

how should I write the equals tag

logic:equals name=FormBeanName property=addedDate
value=What should I put here

Thanking You,
Chamal.  


 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Comparing dates

2006-12-06 Thread mano dasanayake
Hi Chamal,
Try

logic:equals name=FormBeanName property=addedDate
value=%=thedate %
 where thedate is a date Obj...

Best regards,
Mano



-Original Message-
From: chamal desilva [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 06, 2006 3:00 PM
To: user@struts.apache.org
Subject: Comparing dates

Hi,

Is it possible to compare dates with logic equals tag.

My form bean has a property called addedDate.

I need to compare it with date 2006-12-24

how should I write the equals tag

logic:equals name=FormBeanName property=addedDate
value=What should I put here

Thanking You,
Chamal.  


 


Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Complex validation - comparing dates

2005-01-26 Thread Norris Shelton
I'm trying to ensure that the start date is less than the end
date.

field property=startDate depends=validwhen
arg0 key=startDate/
var
var-nametest/var-name
var-value((endDate  startDate) or (*this*
== null))/var-value
/var
/field


I already have validations to ensure that they are valid dates
(before this).

Nothing happens.  Any suggestions?

=

Norris Shelton
Software Engineer
Sun Certified Java 1.1 Programmer
Appriss, Inc.
ICQ# 26487421
AIM NorrisEShelton
YIM norrisshelton





__ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Complex validation - comparing dates

2005-01-26 Thread Erik Weber
As far as I know you need to implement your own pluggable validator (not 
difficult) -- unless Struts has a new feature that automates this (I 
don't know of one but I'm not using the latest version).

Erik
Norris Shelton wrote:
I'm trying to ensure that the start date is less than the end
date.
   field property=startDate depends=validwhen
   arg0 key=startDate/
   var
   var-nametest/var-name
   var-value((endDate  startDate) or (*this*
== null))/var-value
   /var
   /field
I already have validations to ensure that they are valid dates
(before this).
Nothing happens.  Any suggestions?
=
Norris Shelton
Software Engineer
Sun Certified Java 1.1 Programmer
Appriss, Inc.
ICQ# 26487421
AIM NorrisEShelton
YIM norrisshelton

	
		
__ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Complex validation - comparing dates

2005-01-26 Thread Kishore Senji
On Wed, 26 Jan 2005 20:37:08 -0800 (PST), Norris Shelton
[EMAIL PROTECTED] wrote:
 I'm trying to ensure that the start date is less than the end
 date.
 
field property=startDate depends=validwhen
arg0 key=startDate/
var
var-nametest/var-name
var-value((endDate  startDate) or (*this*
 == null))/var-value

ValidWhen does int or String comparisons only. If the two fields
can be converted to int, then numeric comparison is done otherwise a
String comparison is done (by invoking toString() if property is
different from String).

So, if your startDate and endDate are String of (MM/dd/) format
then the comparison would be lexicographical and so you might not be
seeing the desired output. Writing a custom validator or overriding
the ActionForm might be the better alternatives

/var
/field
 
 I already have validations to ensure that they are valid dates
 (before this).
 
 Nothing happens.  Any suggestions?
 
 =
 
 Norris Shelton
 Software Engineer
 Sun Certified Java 1.1 Programmer
 Appriss, Inc.
 ICQ# 26487421
 AIM NorrisEShelton
 YIM norrisshelton
 
 __
 Do you Yahoo!?
 Yahoo! Mail - You care about security. So do we.
 http://promotions.yahoo.com/new_mail
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]