Re: DateUtilities for ActionForms?

2003-06-03 Thread Gareth Andrew
java.util.Date exists simply to *store* dates, the calendar class and 
the dateFormat class exist to *manipulate* dates.  java.sql.Date exists 
because SQL has different conventions for storing a date than the JVM.
The Java API docs for java.util.Date explain the deprecated methods.

"Prior to JDK 1.1, the class |Date| had two additional functions. It 
allowed the interpretation of dates as year, month, day, hour, minute, 
and second values. It also allowed the formatting and parsing of date 
strings. Unfortunately, the API for these functions was not amenable to 
internationalization. As of JDK 1.1, the |Calendar| class should be used 
to convert between dates and time fields and the |DateFormat| class 
should be used to format and parse date strings. The corresponding 
methods in |Date| are deprecated."

java.sql.Date is simply a java.util.Date object that has its hours, 
minutes, and seconds values set to zero since SQL DATEs do not have a 
time component.

In summary,

java.util.Date is the standard java API mechanism for storing a date.
java.sql.Date is a subclass of java.util.Date with a subset of the 
functionality designed to represent the functionality provided by a SQL 
DATE.
java.sql.Timestamp is a composite of Date and an extra nanoseccond value 
designed to represent the functionality provided by a SQL TIMESTAMP.

Gareth

Mark Galbreath wrote:

java.sql.Date is a subclass of java.util.Date (as is java.sql.TimeStamp) and
as far as I can see, is the only reason for the latter's existence.  As
David Flannigan points out in "Java In A Nutshell, 4th Ed" (O'Reilly 2002),
p. 654: "Since Java 1.1 many of the methods in the Date class have been
deprecated in favor of the methods of the Calendar class."  java.sql.Date
exists simply to pass milliseconds through JDBC to and from a database.
Mark
 



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


RE: DateUtilities for ActionForms?

2003-06-03 Thread Mark Galbreath
I gnu you would get me on that!

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 02, 2003 10:19 AM


is the only reason for the latter's existence


Which is the latter? java.util.Date or java.sql.TimeStamp?

Ive never figured out the reason for having a seperate sql version. Dont see
why they couldnt just use java.util.Date...

TimeStamp on the otherhand provides support (in a rather nasty way!) for
nanoseconds...

-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Monday, 2 June 2003 22:06
To: 'Struts Users Mailing List'
Subject: RE: DateUtilities for ActionForms?


java.sql.Date is a subclass of java.util.Date (as is java.sql.TimeStamp) and
as far as I can see, is the only reason for the latter's existence.  As
David Flannigan points out in "Java In A Nutshell, 4th Ed" (O'Reilly 2002),
p. 654: "Since Java 1.1 many of the methods in the Date class have been
deprecated in favor of the methods of the Calendar class."  java.sql.Date
exists simply to pass milliseconds through JDBC to and from a database.

Mark

-Original Message-
From: Gareth Andrew [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 4:07 PM
To: Struts Users Mailing List
Subject: Re: DateUtilities for ActionForms?


What are you talking about?  I assume you mean the java.util.Date class.
This class is anything but deprecated, it is the de facto method of storing
a date in Java. The reason it has a lot of deprecated methods and
constructors is that in 1.2 the class was extensively refactored with a lot
of the functionality moved into helper classes such as Calender and
DateFormat.  I hope this isn't why you are recommending java.sql.date over
java.util.date.

Gareth.

Mark Galbreath wrote:

>Why are you guys continuing to advocate the use of a deprecated class? 
>Look at the API!
>
>Mark
>
>-Original Message-
>From: Gareth Andrew [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 1:59 PM
>To: Struts Users Mailing List
>Subject: Re: DateUtilities for ActionForms?
>
>
>If you want to use Locale aware conversions perhaps you should be using 
>LocaleBeanUtils rather than BeanUtils.  You should be able to convert a 
>string to a date as follows:
>
>java.util.Date myDate = (java.util.Date)LocaleConvertUtils.convert("18
>Jan 2003", Class.forName("java.util.Date"));
>
>If you change your form-properties to strings, copyProperties() should 
>automagically do the String->Date conversion for you - although I think 
>it uses toString() for Date->String so you'd need to use the DateFormat 
>class and some locale information you have about the user
>(request.getLocale()?) to reformat the string.
>
>Gareth
>
>
>
>Mick Knutson wrote:
>
>
>
>>I looked at the javadocs, but I just can't seem to understand how to 
>>use that. I looked at the struts source, but that is never used there. 
>>Does anyone have a working example of this?
>>
>>
>>
>>---
>>Thanks...
>>Mick Knutson
>>---
>>
>>
>>
>>
>>
>>
>>
>>>From: Gareth Andrew <[EMAIL PROTECTED]>
>>>Reply-To: "Struts Users Mailing List" 
>>><[EMAIL PROTECTED]>
>>>To: Struts Users Mailing List <[EMAIL PROTECTED]>
>>>Subject: Re: DateUtilities for ActionForms?
>>>Date: Sat, 31 May 2003 18:23:27 +0100
>>>
>>>Mick,
>>>
>>>Have you tried using the BeanUtils converters. From the docs:
>>>
>>>*org.apache.commons.beanutils.locale.converters.DateLocaleConverter
>>>*
>>>Standard |LocaleConverter| <cid:[EMAIL PROTECTED]>
>>>implementation that converts an incoming locale-sensitive String into 
>>>a |java.util.Date| object, optionally using a default value or 
>>>throwing a |ConversionException| 
>>><cid:[EMAIL PROTECTED]> if a conversion error 
>>>occurs.
>>>
>>>It sounds like it might help, but I haven't used it before so i can't 
>>>comment.  At the very least the source might be useful if you decide 
>>>you need to write your own DateUtilities.
>>>
>>>HTH.
>>>
>>>Gareth.
>>>
>>>Mick Knutson wrote:
>>>
>>>
>>>
>>>>Is there already a set of DateUtilities for ActionForms?
>>>>I am finding myself converting to and from Strings and also 
>>>>reformating my Dates to and from my DB.
>>>>
>>>>I am using EntityBeans and ValueObjects with my ActionForms, so to 
>>>>keep the types in synch, it seems I have

RE: DateUtilities for ActionForms?

2003-06-03 Thread Andrew Hill

is the only reason for the latter's existence


Which is the latter? java.util.Date or java.sql.TimeStamp?

Ive never figured out the reason for having a seperate sql version. Dont see
why they couldnt just use java.util.Date...

TimeStamp on the otherhand provides support (in a rather nasty way!) for
nanoseconds...

-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Monday, 2 June 2003 22:06
To: 'Struts Users Mailing List'
Subject: RE: DateUtilities for ActionForms?


java.sql.Date is a subclass of java.util.Date (as is java.sql.TimeStamp) and
as far as I can see, is the only reason for the latter's existence.  As
David Flannigan points out in "Java In A Nutshell, 4th Ed" (O'Reilly 2002),
p. 654: "Since Java 1.1 many of the methods in the Date class have been
deprecated in favor of the methods of the Calendar class."  java.sql.Date
exists simply to pass milliseconds through JDBC to and from a database.

Mark

-Original Message-
From: Gareth Andrew [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 4:07 PM
To: Struts Users Mailing List
Subject: Re: DateUtilities for ActionForms?


What are you talking about?  I assume you mean the java.util.Date
class.  This class is anything but deprecated, it is the de facto method
of storing a date in Java. The reason it has a lot of deprecated methods
and constructors is that in 1.2 the class was extensively refactored
with a lot of the functionality moved into helper classes such as
Calender and DateFormat.  I hope this isn't why you are recommending
java.sql.date over java.util.date.

Gareth.

Mark Galbreath wrote:

>Why are you guys continuing to advocate the use of a deprecated class?
>Look at the API!
>
>Mark
>
>-Original Message-
>From: Gareth Andrew [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 1:59 PM
>To: Struts Users Mailing List
>Subject: Re: DateUtilities for ActionForms?
>
>
>If you want to use Locale aware conversions perhaps you should be using
>LocaleBeanUtils rather than BeanUtils.  You should be able to convert a
>string to a date as follows:
>
>java.util.Date myDate = (java.util.Date)LocaleConvertUtils.convert("18
>Jan 2003", Class.forName("java.util.Date"));
>
>If you change your form-properties to strings, copyProperties() should
>automagically do the String->Date conversion for you - although I think
>it uses toString() for Date->String so you'd need to use the DateFormat
>class and some locale information you have about the user
>(request.getLocale()?) to reformat the string.
>
>Gareth
>
>
>
>Mick Knutson wrote:
>
>
>
>>I looked at the javadocs, but I just can't seem to understand how to
>>use that. I looked at the struts source, but that is never used there.
>>Does anyone have a working example of this?
>>
>>
>>
>>---
>>Thanks...
>>Mick Knutson
>>---
>>
>>
>>
>>
>>
>>
>>
>>>From: Gareth Andrew <[EMAIL PROTECTED]>
>>>Reply-To: "Struts Users Mailing List"
>>><[EMAIL PROTECTED]>
>>>To: Struts Users Mailing List <[EMAIL PROTECTED]>
>>>Subject: Re: DateUtilities for ActionForms?
>>>Date: Sat, 31 May 2003 18:23:27 +0100
>>>
>>>Mick,
>>>
>>>Have you tried using the BeanUtils converters. From the docs:
>>>
>>>*org.apache.commons.beanutils.locale.converters.DateLocaleConverter
>>>*
>>>Standard |LocaleConverter| <cid:[EMAIL PROTECTED]>
>>>implementation that converts an incoming locale-sensitive String into
>>>a |java.util.Date| object, optionally using a default value or
>>>throwing a |ConversionException|
>>><cid:[EMAIL PROTECTED]> if a conversion error occurs.
>>>
>>>It sounds like it might help, but I haven't used it before so i can't
>>>comment.  At the very least the source might be useful if you decide
>>>you need to write your own DateUtilities.
>>>
>>>HTH.
>>>
>>>Gareth.
>>>
>>>Mick Knutson wrote:
>>>
>>>
>>>
>>>>Is there already a set of DateUtilities for ActionForms?
>>>>I am finding myself converting to and from Strings and also
>>>>reformating my Dates to and from my DB.
>>>>
>>>>I am using EntityBeans and ValueObjects with my ActionForms, so to
>>>>keep the types in synch, it seems I have to do serious conversion
>>>>all the time. Thanks in advance for the help.
>>>>
>>>>---
>>>>Thanks...
>>>>Mick Knutson
>>>&

RE: DateUtilities for ActionForms?

2003-06-03 Thread Mark Galbreath
java.sql.Date is a subclass of java.util.Date (as is java.sql.TimeStamp) and
as far as I can see, is the only reason for the latter's existence.  As
David Flannigan points out in "Java In A Nutshell, 4th Ed" (O'Reilly 2002),
p. 654: "Since Java 1.1 many of the methods in the Date class have been
deprecated in favor of the methods of the Calendar class."  java.sql.Date
exists simply to pass milliseconds through JDBC to and from a database.

Mark

-Original Message-
From: Gareth Andrew [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 4:07 PM
To: Struts Users Mailing List
Subject: Re: DateUtilities for ActionForms?


What are you talking about?  I assume you mean the java.util.Date 
class.  This class is anything but deprecated, it is the de facto method 
of storing a date in Java. The reason it has a lot of deprecated methods 
and constructors is that in 1.2 the class was extensively refactored 
with a lot of the functionality moved into helper classes such as 
Calender and DateFormat.  I hope this isn't why you are recommending 
java.sql.date over java.util.date.

Gareth.

Mark Galbreath wrote:

>Why are you guys continuing to advocate the use of a deprecated class?  
>Look at the API!
>
>Mark
>
>-Original Message-
>From: Gareth Andrew [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 1:59 PM
>To: Struts Users Mailing List
>Subject: Re: DateUtilities for ActionForms?
>
>
>If you want to use Locale aware conversions perhaps you should be using
>LocaleBeanUtils rather than BeanUtils.  You should be able to convert a 
>string to a date as follows:
>
>java.util.Date myDate = (java.util.Date)LocaleConvertUtils.convert("18
>Jan 2003", Class.forName("java.util.Date"));
>
>If you change your form-properties to strings, copyProperties() should
>automagically do the String->Date conversion for you - although I think 
>it uses toString() for Date->String so you'd need to use the DateFormat 
>class and some locale information you have about the user 
>(request.getLocale()?) to reformat the string.
>
>Gareth
>
>
>
>Mick Knutson wrote:
>
>  
>
>>I looked at the javadocs, but I just can't seem to understand how to 
>>use that. I looked at the struts source, but that is never used there. 
>>Does anyone have a working example of this?
>>
>>
>>
>>---
>>Thanks...
>>Mick Knutson
>>---
>>
>>
>>
>>
>>
>>
>>
>>>From: Gareth Andrew <[EMAIL PROTECTED]>
>>>Reply-To: "Struts Users Mailing List"
>>><[EMAIL PROTECTED]>
>>>To: Struts Users Mailing List <[EMAIL PROTECTED]>
>>>Subject: Re: DateUtilities for ActionForms?
>>>Date: Sat, 31 May 2003 18:23:27 +0100
>>>
>>>Mick,
>>>
>>>Have you tried using the BeanUtils converters. From the docs:
>>>
>>>*org.apache.commons.beanutils.locale.converters.DateLocaleConverter
>>>*
>>>Standard |LocaleConverter| <cid:[EMAIL PROTECTED]>
>>>implementation that converts an incoming locale-sensitive String into
>>>a |java.util.Date| object, optionally using a default value or 
>>>throwing a |ConversionException| 
>>><cid:[EMAIL PROTECTED]> if a conversion error occurs.
>>>
>>>It sounds like it might help, but I haven't used it before so i can't 
>>>comment.  At the very least the source might be useful if you decide 
>>>you need to write your own DateUtilities.
>>>
>>>HTH.
>>>
>>>Gareth.
>>>
>>>Mick Knutson wrote:
>>>
>>>  
>>>
>>>>Is there already a set of DateUtilities for ActionForms?
>>>>I am finding myself converting to and from Strings and also 
>>>>reformating my Dates to and from my DB.
>>>>
>>>>I am using EntityBeans and ValueObjects with my ActionForms, so to 
>>>>keep the types in synch, it seems I have to do serious conversion 
>>>>all the time. Thanks in advance for the help.
>>>>
>>>>---
>>>>Thanks...
>>>>Mick Knutson
>>>>---
>>>>
>>>>_
>>>>The new MSN 8: smart spam protection and 2 months FREE* 
>>>>http://join.msn.com/?page=features/junkmail
>>>>
>>>>
>>>>
>>>>-
>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>&g

Re: DateUtilities for ActionForms?

2003-06-01 Thread Gareth Andrew
What are you talking about?  I assume you mean the java.util.Date 
class.  This class is anything but deprecated, it is the de facto method 
of storing a date in Java. The reason it has a lot of deprecated methods 
and constructors is that in 1.2 the class was extensively refactored 
with a lot of the functionality moved into helper classes such as 
Calender and DateFormat.  I hope this isn't why you are recommending 
java.sql.date over java.util.date.

Gareth.

Mark Galbreath wrote:

Why are you guys continuing to advocate the use of a deprecated class?  Look
at the API!
Mark

-Original Message-
From: Gareth Andrew [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 1:59 PM
To: Struts Users Mailing List
Subject: Re: DateUtilities for ActionForms?

If you want to use Locale aware conversions perhaps you should be using 
LocaleBeanUtils rather than BeanUtils.  You should be able to convert a 
string to a date as follows:

java.util.Date myDate = (java.util.Date)LocaleConvertUtils.convert("18 
Jan 2003", Class.forName("java.util.Date"));

If you change your form-properties to strings, copyProperties() should 
automagically do the String->Date conversion for you - although I think 
it uses toString() for Date->String so you'd need to use the DateFormat 
class and some locale information you have about the user 
(request.getLocale()?) to reformat the string.

Gareth



Mick Knutson wrote:

 

I looked at the javadocs, but I just can't seem to understand how to
use that. I looked at the struts source, but that is never used there.
Does anyone have a working example of this?


---
Thanks...
Mick Knutson
---




   

From: Gareth Andrew <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" 
<[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: DateUtilities for ActionForms?
Date: Sat, 31 May 2003 18:23:27 +0100

Mick,

Have you tried using the BeanUtils converters. From the docs:

*org.apache.commons.beanutils.locale.converters.DateLocaleConverter
*
Standard |LocaleConverter| <cid:[EMAIL PROTECTED]>
implementation that converts an incoming locale-sensitive String into 
a |java.util.Date| object, optionally using a default value or 
throwing a |ConversionException| 
<cid:[EMAIL PROTECTED]> if a conversion error occurs.

It sounds like it might help, but I haven't used it before so i can't
comment.  At the very least the source might be useful if you decide 
you need to write your own DateUtilities.

HTH.

Gareth.

Mick Knutson wrote:

 

Is there already a set of DateUtilities for ActionForms?
I am finding myself converting to and from Strings and also
reformating my Dates to and from my DB.
I am using EntityBeans and ValueObjects with my ActionForms, so to
keep the types in synch, it seems I have to do serious conversion 
all the time.
Thanks in advance for the help.

---
Thanks...
Mick Knutson
---
_
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

-
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]
 

_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
-
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]


-
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: DateUtilities for ActionForms?

2003-06-01 Thread Mick Knutson
DUDE! It is 8pm in Zurich, and I have a Date with a crowd of Englishman and 
Swedish drinkers in 2 hours to make _everything_ better.

Enjoy the night!

---
Thanks...
Mick Knutson
---




From: "Mark Galbreath" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: DateUtilities for ActionForms?
Date: Sat, 31 May 2003 14:01:45 -0400
Drink more microbrew.

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 2:00 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?
Thanks.
I can't wait till the pain is over and the euphoric numbing takes over...
;-)


---
Thanks...
Mick Knutson
---




>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Sat, 31 May 2003 13:56:21 -0400
>
>I feel your pain, dude.
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 1:52 PM
>To: [EMAIL PROTECTED]
>Subject: RE: DateUtilities for ActionForms?
>
>
>I guess that is what I will have to do and re-visit this later. I _do_
>thank
>you for your help on this.
>
>
>
>---
>Thanks...
>Mick Knutson
>---
>
>
>
>
>
> >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List"
> ><[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Subject: RE: DateUtilities for ActionForms?
> >Date: Sat, 31 May 2003 13:46:53 -0400
> >
> >I'd advise that, since you are under a deadline here, that you change
> >the type from Date to String and do the conversions in your Action
> >class.  At least until we can figure out what is wrong.  And I would
> >use Calendar, not Date, in the Action class.  Ted just posted some
> >great wrapper classes for this purpose, or you can use the method I
> >posted yesterday in your Action for the conversion.  See
> >http://jakarta.apache.org/struts/userGuide/building_controller.html#d
> >yn
> >a_act
> >ion_form_classes for more info.
> >
> >Mark
> >
> >-Original Message-
> >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> >Sent: Saturday, May 31, 2003 1:41 PM
> >To: [EMAIL PROTECTED]
> >Subject: RE: DateUtilities for ActionForms?
> >
> >
> >I just tried again, and get the BeanUtils.populate error. No other
> >stacktrace. I really hate that. It tells me nothing about the actual
> >error, and it seems to be somewhere in the Controller I think. But it
> >_is_ because of the dates. I have commented out the dates so I can
> >finish some other parts that I need to work on, and it works. But the
> >dates are the heart or this Action. So it will not be finished unless
> >I figure this out.
> >
> >What else could I send you?
> >
> >
> >
> >---
> >Thanks...
> >Mick Knutson
> >---
> >
> >
> >
> >
> >
> > >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> > >Reply-To: "Struts Users Mailing List"
> > ><[EMAIL PROTECTED]>
> > >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> > >Subject: RE: DateUtilities for ActionForms?
> > >Date: Sat, 31 May 2003 13:34:05 -0400
> > >
> > >Yes, you would have to change all references in any class.
> > >
> > >-Original Message-
> > >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> > >Sent: Saturday, May 31, 2003 1:25 PM
> > >To: [EMAIL PROTECTED]
> > >Subject: RE: DateUtilities for ActionForms?
> > >
> > >
> > >I will try that, but would I also have to change my ValueObject as
> > >well from
> > >
> > >java.util.Date to java.sql.Date?
> > >
> > >Because I _did_ try this with both the VO and the DF as
> > >java.sql.Date, and I
> > >
> > >got the same error:
> > >"BeanUtils.populate"
> > >When I submitted the form.
> > >
> > >
> > >
> > >---
> > >Thanks...
> > >Mick Knutson
> > >---
> > >
> > >
> > >
> > >
> > >
> > > >From: "Mark Galbreath" <[EMAIL PROTECTED]>
&

RE: DateUtilities for ActionForms?

2003-06-01 Thread Mark Galbreath
Why are you guys continuing to advocate the use of a deprecated class?  Look
at the API!

Mark

-Original Message-
From: Gareth Andrew [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 1:59 PM
To: Struts Users Mailing List
Subject: Re: DateUtilities for ActionForms?


If you want to use Locale aware conversions perhaps you should be using 
LocaleBeanUtils rather than BeanUtils.  You should be able to convert a 
string to a date as follows:

java.util.Date myDate = (java.util.Date)LocaleConvertUtils.convert("18 
Jan 2003", Class.forName("java.util.Date"));

If you change your form-properties to strings, copyProperties() should 
automagically do the String->Date conversion for you - although I think 
it uses toString() for Date->String so you'd need to use the DateFormat 
class and some locale information you have about the user 
(request.getLocale()?) to reformat the string.

Gareth



Mick Knutson wrote:

> I looked at the javadocs, but I just can't seem to understand how to
> use that. I looked at the struts source, but that is never used there.
> Does anyone have a working example of this?
>
>
>
> ---
> Thanks...
> Mick Knutson
> ---
>
>
>
>
>
>> From: Gareth Andrew <[EMAIL PROTECTED]>
>> Reply-To: "Struts Users Mailing List" 
>> <[EMAIL PROTECTED]>
>> To: Struts Users Mailing List <[EMAIL PROTECTED]>
>> Subject: Re: DateUtilities for ActionForms?
>> Date: Sat, 31 May 2003 18:23:27 +0100
>>
>> Mick,
>>
>> Have you tried using the BeanUtils converters. From the docs:
>>
>> *org.apache.commons.beanutils.locale.converters.DateLocaleConverter
>> *
>> Standard |LocaleConverter| <cid:[EMAIL PROTECTED]>
>> implementation that converts an incoming locale-sensitive String into 
>> a |java.util.Date| object, optionally using a default value or 
>> throwing a |ConversionException| 
>> <cid:[EMAIL PROTECTED]> if a conversion error occurs.
>>
>> It sounds like it might help, but I haven't used it before so i can't
>> comment.  At the very least the source might be useful if you decide 
>> you need to write your own DateUtilities.
>>
>> HTH.
>>
>> Gareth.
>>
>> Mick Knutson wrote:
>>
>>> Is there already a set of DateUtilities for ActionForms?
>>> I am finding myself converting to and from Strings and also
>>> reformating my Dates to and from my DB.
>>>
>>> I am using EntityBeans and ValueObjects with my ActionForms, so to
>>> keep the types in synch, it seems I have to do serious conversion 
>>> all the time.
>>> Thanks in advance for the help.
>>>
>>> ---
>>> Thanks...
>>> Mick Knutson
>>> ---
>>>
>>> _
>>> The new MSN 8: smart spam protection and 2 months FREE*
>>> http://join.msn.com/?page=features/junkmail
>>>
>>>
>>> 
>>> -
>>> 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]
>>
>
> _
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> -
> 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]




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



RE: DateUtilities for ActionForms?

2003-06-01 Thread Mark Galbreath
Drink more microbrew.

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 2:00 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?


Thanks.
I can't wait till the pain is over and the euphoric numbing takes over... 
;-)



---
Thanks...
Mick Knutson
---





>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Sat, 31 May 2003 13:56:21 -0400
>
>I feel your pain, dude.
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 1:52 PM
>To: [EMAIL PROTECTED]
>Subject: RE: DateUtilities for ActionForms?
>
>
>I guess that is what I will have to do and re-visit this later. I _do_
>thank
>you for your help on this.
>
>
>
>---
>Thanks...
>Mick Knutson
>---
>
>
>
>
>
> >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" 
> ><[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Subject: RE: DateUtilities for ActionForms?
> >Date: Sat, 31 May 2003 13:46:53 -0400
> >
> >I'd advise that, since you are under a deadline here, that you change 
> >the type from Date to String and do the conversions in your Action 
> >class.  At least until we can figure out what is wrong.  And I would 
> >use Calendar, not Date, in the Action class.  Ted just posted some 
> >great wrapper classes for this purpose, or you can use the method I 
> >posted yesterday in your Action for the conversion.  See 
> >http://jakarta.apache.org/struts/userGuide/building_controller.html#d
> >yn
> >a_act
> >ion_form_classes for more info.
> >
> >Mark
> >
> >-Original Message-
> >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> >Sent: Saturday, May 31, 2003 1:41 PM
> >To: [EMAIL PROTECTED]
> >Subject: RE: DateUtilities for ActionForms?
> >
> >
> >I just tried again, and get the BeanUtils.populate error. No other 
> >stacktrace. I really hate that. It tells me nothing about the actual 
> >error, and it seems to be somewhere in the Controller I think. But it 
> >_is_ because of the dates. I have commented out the dates so I can 
> >finish some other parts that I need to work on, and it works. But the 
> >dates are the heart or this Action. So it will not be finished unless 
> >I figure this out.
> >
> >What else could I send you?
> >
> >
> >
> >---
> >Thanks...
> >Mick Knutson
> >---
> >
> >
> >
> >
> >
> > >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> > >Reply-To: "Struts Users Mailing List" 
> > ><[EMAIL PROTECTED]>
> > >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> > >Subject: RE: DateUtilities for ActionForms?
> > >Date: Sat, 31 May 2003 13:34:05 -0400
> > >
> > >Yes, you would have to change all references in any class.
> > >
> > >-Original Message-
> > >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> > >Sent: Saturday, May 31, 2003 1:25 PM
> > >To: [EMAIL PROTECTED]
> > >Subject: RE: DateUtilities for ActionForms?
> > >
> > >
> > >I will try that, but would I also have to change my ValueObject as 
> > >well from
> > >
> > >java.util.Date to java.sql.Date?
> > >
> > >Because I _did_ try this with both the VO and the DF as 
> > >java.sql.Date, and I
> > >
> > >got the same error:
> > >"BeanUtils.populate"
> > >When I submitted the form.
> > >
> > >
> > >
> > >---
> > >Thanks...
> > >Mick Knutson
> > >---
> > >
> > >
> > >
> > >
> > >
> > > >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> > > >Reply-To: "Struts Users Mailing List" 
> > > ><[EMAIL PROTECTED]>
> > > >To: "'Struts Users Mailing List'" 
> > > ><[EMAIL PROTECTED]>
> > > >Subject: RE: DateUtilities for ActionForms?
> > > >Date: Sat, 31 May 2003 13:07:43 -0400
> > > >
> > > >try changing
> > > >
> > > >
&

RE: DateUtilities for ActionForms?

2003-06-01 Thread Mick Knutson
Thanks.
I can't wait till the pain is over and the euphoric numbing takes over... 
;-)



---
Thanks...
Mick Knutson
---




From: "Mark Galbreath" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: DateUtilities for ActionForms?
Date: Sat, 31 May 2003 13:56:21 -0400
I feel your pain, dude.

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 1:52 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?
I guess that is what I will have to do and re-visit this later. I _do_ 
thank
you for your help on this.



---
Thanks...
Mick Knutson
---




>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Sat, 31 May 2003 13:46:53 -0400
>
>I'd advise that, since you are under a deadline here, that you change
>the type from Date to String and do the conversions in your Action
>class.  At least until we can figure out what is wrong.  And I would
>use Calendar, not Date, in the Action class.  Ted just posted some
>great wrapper classes for this purpose, or you can use the method I
>posted yesterday in your Action for the conversion.  See
>http://jakarta.apache.org/struts/userGuide/building_controller.html#dyn
>a_act
>ion_form_classes for more info.
>
>Mark
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 1:41 PM
>To: [EMAIL PROTECTED]
>Subject: RE: DateUtilities for ActionForms?
>
>
>I just tried again, and get the BeanUtils.populate error. No other
>stacktrace. I really hate that. It tells me nothing about the actual
>error, and it seems to be somewhere in the Controller I think. But it
>_is_ because of the dates. I have commented out the dates so I can
>finish some other parts that I need to work on, and it works. But the
>dates are the heart or this Action. So it will not be finished unless I
>figure this out.
>
>What else could I send you?
>
>
>
>---
>Thanks...
>Mick Knutson
>---
>
>
>
>
>
> >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List"
> ><[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Subject: RE: DateUtilities for ActionForms?
> >Date: Sat, 31 May 2003 13:34:05 -0400
> >
> >Yes, you would have to change all references in any class.
> >
> >-Original Message-
> >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> >Sent: Saturday, May 31, 2003 1:25 PM
> >To: [EMAIL PROTECTED]
> >Subject: RE: DateUtilities for ActionForms?
> >
> >
> >I will try that, but would I also have to change my ValueObject as
> >well from
> >
> >java.util.Date to java.sql.Date?
> >
> >Because I _did_ try this with both the VO and the DF as
> >java.sql.Date, and I
> >
> >got the same error:
> >"BeanUtils.populate"
> >When I submitted the form.
> >
> >
> >
> >---
> >Thanks...
> >Mick Knutson
> >---
> >
> >
> >
> >
> >
> > >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> > >Reply-To: "Struts Users Mailing List"
> > ><[EMAIL PROTECTED]>
> > >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> > >Subject: RE: DateUtilities for ActionForms?
> > >Date: Sat, 31 May 2003 13:07:43 -0400
> > >
> > >try changing
> > >
> > >
> > >
> > >to
> > >
> > >
> > >
> > >Mark
> > >
> > >-Original Message-
> > >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> > >Sent: Saturday, May 31, 2003 12:35 PM
> > >To: [EMAIL PROTECTED]
> > >Subject: RE: DateUtilities for ActionForms?
> > >
> > >
> > >Here is my JSP:
> > >
> > >   	
> > > 
> > > 	
>maxlength="32"
> > >/>
> > >   	
> > >
> > >My DynaForm declaration:
> > >-===
> > > 
> > > dynamic="true"
> > >
> >type="org.apache.struts.validator.DynaValidatorForm">
> > >

Re: DateUtilities for ActionForms?

2003-06-01 Thread Gareth Andrew
If you want to use Locale aware conversions perhaps you should be using 
LocaleBeanUtils rather than BeanUtils.  You should be able to convert a 
string to a date as follows:

java.util.Date myDate = (java.util.Date)LocaleConvertUtils.convert("18 
Jan 2003", Class.forName("java.util.Date"));

If you change your form-properties to strings, copyProperties() should 
automagically do the String->Date conversion for you - although I think 
it uses toString() for Date->String so you'd need to use the DateFormat 
class and some locale information you have about the user 
(request.getLocale()?) to reformat the string.

Gareth



Mick Knutson wrote:

I looked at the javadocs, but I just can't seem to understand how to 
use that. I looked at the struts source, but that is never used there.
Does anyone have a working example of this?



---
Thanks...
Mick Knutson
---




From: Gareth Andrew <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: DateUtilities for ActionForms?
Date: Sat, 31 May 2003 18:23:27 +0100
Mick,

Have you tried using the BeanUtils converters. From the docs:

*org.apache.commons.beanutils.locale.converters.DateLocaleConverter
*
Standard |LocaleConverter| <cid:[EMAIL PROTECTED]> 
implementation that converts an incoming locale-sensitive String into 
a |java.util.Date| object, optionally using a default value or 
throwing a |ConversionException| 
<cid:[EMAIL PROTECTED]> if a conversion error occurs.

It sounds like it might help, but I haven't used it before so i can't 
comment.  At the very least the source might be useful if you decide 
you need to write your own DateUtilities.

HTH.

Gareth.

Mick Knutson wrote:

Is there already a set of DateUtilities for ActionForms?
I am finding myself converting to and from Strings and also 
reformating my Dates to and from my DB.

I am using EntityBeans and ValueObjects with my ActionForms, so to 
keep the types in synch, it seems I have to do serious conversion 
all the time.
Thanks in advance for the help.

---
Thanks...
Mick Knutson
---
_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

-
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]
_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

-
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: DateUtilities for ActionForms?

2003-06-01 Thread Mark Galbreath
I feel your pain, dude.

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 1:52 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?


I guess that is what I will have to do and re-visit this later. I _do_ thank
you for your help on this.



---
Thanks...
Mick Knutson
---





>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Sat, 31 May 2003 13:46:53 -0400
>
>I'd advise that, since you are under a deadline here, that you change 
>the type from Date to String and do the conversions in your Action 
>class.  At least until we can figure out what is wrong.  And I would 
>use Calendar, not Date, in the Action class.  Ted just posted some 
>great wrapper classes for this purpose, or you can use the method I 
>posted yesterday in your Action for the conversion.  See 
>http://jakarta.apache.org/struts/userGuide/building_controller.html#dyn
>a_act
>ion_form_classes for more info.
>
>Mark
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 1:41 PM
>To: [EMAIL PROTECTED]
>Subject: RE: DateUtilities for ActionForms?
>
>
>I just tried again, and get the BeanUtils.populate error. No other 
>stacktrace. I really hate that. It tells me nothing about the actual 
>error, and it seems to be somewhere in the Controller I think. But it 
>_is_ because of the dates. I have commented out the dates so I can 
>finish some other parts that I need to work on, and it works. But the 
>dates are the heart or this Action. So it will not be finished unless I 
>figure this out.
>
>What else could I send you?
>
>
>
>---
>Thanks...
>Mick Knutson
>---
>
>
>
>
>
> >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" 
> ><[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Subject: RE: DateUtilities for ActionForms?
> >Date: Sat, 31 May 2003 13:34:05 -0400
> >
> >Yes, you would have to change all references in any class.
> >
> >-Original Message-
> >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> >Sent: Saturday, May 31, 2003 1:25 PM
> >To: [EMAIL PROTECTED]
> >Subject: RE: DateUtilities for ActionForms?
> >
> >
> >I will try that, but would I also have to change my ValueObject as 
> >well from
> >
> >java.util.Date to java.sql.Date?
> >
> >Because I _did_ try this with both the VO and the DF as 
> >java.sql.Date, and I
> >
> >got the same error:
> >"BeanUtils.populate"
> >When I submitted the form.
> >
> >
> >
> >---
> >Thanks...
> >Mick Knutson
> >---
> >
> >
> >
> >
> >
> > >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> > >Reply-To: "Struts Users Mailing List" 
> > ><[EMAIL PROTECTED]>
> > >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> > >Subject: RE: DateUtilities for ActionForms?
> > >Date: Sat, 31 May 2003 13:07:43 -0400
> > >
> > >try changing
> > >
> > >
> > >
> > >to
> > >
> > >
> > >
> > >Mark
> > >
> > >-Original Message-
> > >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> > >Sent: Saturday, May 31, 2003 12:35 PM
> > >To: [EMAIL PROTECTED]
> > >Subject: RE: DateUtilities for ActionForms?
> > >
> > >
> > >Here is my JSP:
> > >
> > >   
> > > 
> > >   maxlength="32"
> > >/>
> > >   
> > >
> > >My DynaForm declaration:
> > >-===
> > >  > > dynamic="true"
> > >
> >type="org.apache.struts.validator.DynaValidatorForm">
> > > 
> > > 
> > >
> > >  > > />
> > >
> > >  > > type="java.util.Date" />
> > >
> > >  > > type="java.lang.String"
>/>
> > >  > >type="java.lang.String" />
> > >  >type="java.lang.String"

RE: DateUtilities for ActionForms?

2003-06-01 Thread Mick Knutson
I guess that is what I will have to do and re-visit this later.
I _do_ thank you for your help on this.


---
Thanks...
Mick Knutson
---




From: "Mark Galbreath" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: DateUtilities for ActionForms?
Date: Sat, 31 May 2003 13:46:53 -0400
I'd advise that, since you are under a deadline here, that you change the
type from Date to String and do the conversions in your Action class.  At
least until we can figure out what is wrong.  And I would use Calendar, not
Date, in the Action class.  Ted just posted some great wrapper classes for
this purpose, or you can use the method I posted yesterday in your Action
for the conversion.  See
http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna_act
ion_form_classes for more info.
Mark

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 1:41 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?
I just tried again, and get the BeanUtils.populate error. No other
stacktrace. I really hate that. It tells me nothing about the actual error,
and it seems to be somewhere in the Controller I think.
But it _is_ because of the dates. I have commented out the dates so I can
finish some other parts that I need to work on, and it works. But the dates
are the heart or this Action. So it will not be finished unless I figure
this out.
What else could I send you?



---
Thanks...
Mick Knutson
---




>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Sat, 31 May 2003 13:34:05 -0400
>
>Yes, you would have to change all references in any class.
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 1:25 PM
>To: [EMAIL PROTECTED]
>Subject: RE: DateUtilities for ActionForms?
>
>
>I will try that, but would I also have to change my ValueObject as well
>from
>
>java.util.Date to java.sql.Date?
>
>Because I _did_ try this with both the VO and the DF as java.sql.Date,
>and
>I
>
>got the same error:
>"BeanUtils.populate"
>When I submitted the form.
>
>
>
>---
>Thanks...
>Mick Knutson
>---
>
>
>
>
>
> >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List"
> ><[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Subject: RE: DateUtilities for ActionForms?
> >Date: Sat, 31 May 2003 13:07:43 -0400
> >
> >try changing
> >
> >
> >
> >to
> >
> >
> >
> >Mark
> >
> >-Original Message-
> >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> >Sent: Saturday, May 31, 2003 12:35 PM
> >To: [EMAIL PROTECTED]
> >Subject: RE: DateUtilities for ActionForms?
> >
> >
> >Here is my JSP:
> >
> >   	
> > 
> > 	
maxlength="32"
> >/>
> >   	
> >
> >My DynaForm declaration:
> >-===
> > 
> > dynamic="true"
> >
>type="org.apache.struts.validator.DynaValidatorForm">
> > 
> > 
> >
> > 
> >
> > 
> > />
> >
> > 
> > 
> >type="java.lang.String" />
> > 
>type="java.lang.String"
> >/>
> >
> > 
> > />
> >
> > 
> > 
> > 
> > 
> >type="java.lang.String" />
> >
> > 
> >type="java.lang.String[]" />
> > 
> >type="com.baselogic.yoursos.contact.ContactDto[]" />
> > 
> > 
> > 
> >
> >
> >My Action Declaration:
> >===
> > 
> > input="/alertList.do"
> > name="alertForm"
> > parameter="action"
> > scope="request"
> > type="com.baselogic.yoursos.alert.AlertActions"
> > validate="true"
> > >
> >

RE: DateUtilities for ActionForms?

2003-06-01 Thread Mark Galbreath
I'd advise that, since you are under a deadline here, that you change the
type from Date to String and do the conversions in your Action class.  At
least until we can figure out what is wrong.  And I would use Calendar, not
Date, in the Action class.  Ted just posted some great wrapper classes for
this purpose, or you can use the method I posted yesterday in your Action
for the conversion.  See
http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna_act
ion_form_classes for more info.

Mark

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 1:41 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?


I just tried again, and get the BeanUtils.populate error. No other 
stacktrace. I really hate that. It tells me nothing about the actual error, 
and it seems to be somewhere in the Controller I think.
But it _is_ because of the dates. I have commented out the dates so I can 
finish some other parts that I need to work on, and it works. But the dates 
are the heart or this Action. So it will not be finished unless I figure 
this out.

What else could I send you?



---
Thanks...
Mick Knutson
---





>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Sat, 31 May 2003 13:34:05 -0400
>
>Yes, you would have to change all references in any class.
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 1:25 PM
>To: [EMAIL PROTECTED]
>Subject: RE: DateUtilities for ActionForms?
>
>
>I will try that, but would I also have to change my ValueObject as well
>from
>
>java.util.Date to java.sql.Date?
>
>Because I _did_ try this with both the VO and the DF as java.sql.Date, 
>and
>I
>
>got the same error:
>"BeanUtils.populate"
>When I submitted the form.
>
>
>
>---
>Thanks...
>Mick Knutson
>---
>
>
>
>
>
> >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" 
> ><[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Subject: RE: DateUtilities for ActionForms?
> >Date: Sat, 31 May 2003 13:07:43 -0400
> >
> >try changing
> >
> >
> >
> >to
> >
> >
> >
> >Mark
> >
> >-Original Message-
> >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> >Sent: Saturday, May 31, 2003 12:35 PM
> >To: [EMAIL PROTECTED]
> >Subject: RE: DateUtilities for ActionForms?
> >
> >
> >Here is my JSP:
> >
> > 
> > 
> >  >/>
> > 
> >
> >My DynaForm declaration:
> >-===
> >  > dynamic="true"
> > 
>type="org.apache.struts.validator.DynaValidatorForm">
> > 
> > 
> >
> > 
> >
> >  > />
> >
> > 
> >  >type="java.lang.String" />
> > type="java.lang.String"
> >/>
> >
> >  > />
> >
> > 
> > 
> > 
> >  >type="java.lang.String" />
> >
> >  >type="java.lang.String[]" />
> >  >type="com.baselogic.yoursos.contact.ContactDto[]" />
> > 
> > 
> > 
> >
> >
> >My Action Declaration:
> >===
> >  > input="/alertList.do"
> > name="alertForm"
> > parameter="action"
> > scope="request"
> > type="com.baselogic.yoursos.alert.AlertActions"
> > validate="true"
> > >
> >  >redirect="true"
>
> >/>
> > 
> > 
> > 
> > 
> > 
> >
> >
> >My AlertActions.java default method: 
> > public ActionForward defaultMethod( ActionMapping mapping
> > , ActionForm form
> >

RE: DateUtilities for ActionForms?

2003-06-01 Thread Mick Knutson
I just tried again, and get the BeanUtils.populate error. No other 
stacktrace. I really hate that. It tells me nothing about the actual error, 
and it seems to be somewhere in the Controller I think.
But it _is_ because of the dates. I have commented out the dates so I can 
finish some other parts that I need to work on, and it works. But the dates 
are the heart or this Action. So it will not be finished unless I figure 
this out.

What else could I send you?



---
Thanks...
Mick Knutson
---




From: "Mark Galbreath" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: DateUtilities for ActionForms?
Date: Sat, 31 May 2003 13:34:05 -0400
Yes, you would have to change all references in any class.

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 1:25 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?
I will try that, but would I also have to change my ValueObject as well 
from

java.util.Date to java.sql.Date?

Because I _did_ try this with both the VO and the DF as java.sql.Date, and 
I

got the same error:
"BeanUtils.populate"
When I submitted the form.


---
Thanks...
Mick Knutson
---




>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Sat, 31 May 2003 13:07:43 -0400
>
>try changing
>
>
>
>to
>
>
>
>Mark
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 12:35 PM
>To: [EMAIL PROTECTED]
>Subject: RE: DateUtilities for ActionForms?
>
>
>Here is my JSP:
>
>   	
> 
> 	
>/>
>   	
>
>My DynaForm declaration:
>-===
> 
> dynamic="true"
> 
type="org.apache.struts.validator.DynaValidatorForm">
> 
> 
>
> 
>
> 
> />
>
> 
> 
>type="java.lang.String"
>/>
> 
>/>
>
> 
>
> 
> 
> 
> 
>type="java.lang.String" />
>
> 
>type="java.lang.String[]"
>/>
> 
>type="com.baselogic.yoursos.contact.ContactDto[]" />
> 
> 
> 
>
>
>My Action Declaration:
>===
> 
> input="/alertList.do"
> name="alertForm"
> parameter="action"
> scope="request"
> type="com.baselogic.yoursos.alert.AlertActions"
> validate="true"
> >
> 	

>/>
> 	
> 
> 
> 	
> 
>
>
>My AlertActions.java default method: 
> public ActionForward defaultMethod( ActionMapping mapping
> , ActionForm form
> , HttpServletRequest request
> , HttpServletResponse response
> )
> throws AlertNotFoundException, Exception
> {
> log.info( "Process a AlertActions.defaultMethod()" );
>
> //IUserServices usd = this.getUserService();
>
> AlertDto alertDto = new AlertDto();
>
> //form = setFormDatesToDate( form );
> BeanUtils.copyProperties( alertDto, form );
>
> UserDto userDto = this.getUserService().findUser(
>getUserContainer(
>request ).getUserLightDto().getUserId() );
> ContactDto[] userContacts = userDto.getUserContacts();
>
> log.info( "userContacts[] length: " + userContacts.length );
>
> if( alertDto.getAlertId().equals( "" ) )
> {
> // Must be a new alert then
> log.info( "Must be a new alert then" );
> alertDto.setUserId( userDto.getUserId() );
> log.info( "alertDto: " + alertDto.toString() );
>
> ( ( DynaActionForm ) form ).set(
>Constants.USER_CONTACTS_KEY, userContacts );
> BeanUtils.copyProperties( form, alertDto );
> //form = setFormDate

RE: DateUtilities for ActionForms?

2003-06-01 Thread Mark Galbreath
Yes, you would have to change all references in any class.

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 1:25 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?


I will try that, but would I also have to change my ValueObject as well from

java.util.Date to java.sql.Date?

Because I _did_ try this with both the VO and the DF as java.sql.Date, and I

got the same error:
"BeanUtils.populate"
When I submitted the form.



---
Thanks...
Mick Knutson
---





>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Sat, 31 May 2003 13:07:43 -0400
>
>try changing
>
>
>
>to
>
>
>
>Mark
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 12:35 PM
>To: [EMAIL PROTECTED]
>Subject: RE: DateUtilities for ActionForms?
>
>
>Here is my JSP:
>
>   
> 
>   />
>   
>
>My DynaForm declaration:
>-===
>  dynamic="true"
> type="org.apache.struts.validator.DynaValidatorForm">
> 
> 
>
> 
>
>  />
>
> 
> type="java.lang.String"
>/>
> />
>
> 
>
> 
> 
> 
> type="java.lang.String" />
>
> type="java.lang.String[]"
>/>
> type="com.baselogic.yoursos.contact.ContactDto[]" />
> 
> 
> 
>
>
>My Action Declaration:
>===
>  input="/alertList.do"
> name="alertForm"
> parameter="action"
> scope="request"
> type="com.baselogic.yoursos.alert.AlertActions"
> validate="true"
> >
>   />
>   
> 
> 
>   
> 
>
>
>My AlertActions.java default method: 
> public ActionForward defaultMethod( ActionMapping mapping
> , ActionForm form
> , HttpServletRequest request
> , HttpServletResponse response
> )
> throws AlertNotFoundException, Exception
> {
> log.info( "Process a AlertActions.defaultMethod()" );
>
> //IUserServices usd = this.getUserService();
>
> AlertDto alertDto = new AlertDto();
>
> //form = setFormDatesToDate( form );
> BeanUtils.copyProperties( alertDto, form );
>
> UserDto userDto = this.getUserService().findUser(
>getUserContainer(
>request ).getUserLightDto().getUserId() );
> ContactDto[] userContacts = userDto.getUserContacts();
>
> log.info( "userContacts[] length: " + userContacts.length );
>
> if( alertDto.getAlertId().equals( "" ) )
> {
> // Must be a new alert then
> log.info( "Must be a new alert then" );
> alertDto.setUserId( userDto.getUserId() );
> log.info( "alertDto: " + alertDto.toString() );
>
> ( ( DynaActionForm ) form ).set( 
>Constants.USER_CONTACTS_KEY, userContacts );
> BeanUtils.copyProperties( form, alertDto );
> //form = setFormDatesToString( form );
>
> return ( mapping.findForward( Constants.ADD_FWD ) );
> }
>
> log.info( "Must be an existing alert then" );
>
> // Get the required AlertDto...
> alertDto = this.getAlertService().findAlert( 
>alertDto.getAlertId() );
>
> // Do we need to re-set the 2 dates from Dates, into Strings here?
> BeanUtils.copyProperties( form, alertDto );
>
> // We need to add the String[] object from our ContactDto[]
>
> return ( mapping.findForward( Constants.VIEW_FWD ) );
> }
>
>
>My AlertActions.java add method: 
> public ActionForward add( ActionMapping mapping
>   , ActionForm form
>

Re: DateUtilities for ActionForms?

2003-06-01 Thread Mick Knutson
I looked at the javadocs, but I just can't seem to understand how to use 
that. I looked at the struts source, but that is never used there.
Does anyone have a working example of this?



---
Thanks...
Mick Knutson
---




From: Gareth Andrew <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: DateUtilities for ActionForms?
Date: Sat, 31 May 2003 18:23:27 +0100
Mick,

Have you tried using the BeanUtils converters. From the docs:

*org.apache.commons.beanutils.locale.converters.DateLocaleConverter
*
Standard |LocaleConverter| <cid:[EMAIL PROTECTED]> 
implementation that converts an incoming locale-sensitive String into a 
|java.util.Date| object, optionally using a default value or throwing a 
|ConversionException| <cid:[EMAIL PROTECTED]> if a 
conversion error occurs.

It sounds like it might help, but I haven't used it before so i can't 
comment.  At the very least the source might be useful if you decide you 
need to write your own DateUtilities.

HTH.

Gareth.

Mick Knutson wrote:

Is there already a set of DateUtilities for ActionForms?
I am finding myself converting to and from Strings and also reformating my 
Dates to and from my DB.

I am using EntityBeans and ValueObjects with my ActionForms, so to keep 
the types in synch, it seems I have to do serious conversion all the time.
Thanks in advance for the help.

---
Thanks...
Mick Knutson
---
_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

-
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]
_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


RE: DateUtilities for ActionForms?

2003-06-01 Thread Mick Knutson
I will try that, but would I also have to change my ValueObject as well from 
java.util.Date to java.sql.Date?

Because I _did_ try this with both the VO and the DF as java.sql.Date, and I 
got the same error:
"BeanUtils.populate"
When I submitted the form.



---
Thanks...
Mick Knutson
---




From: "Mark Galbreath" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: DateUtilities for ActionForms?
Date: Sat, 31 May 2003 13:07:43 -0400
try changing



to



Mark

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 12:35 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?
Here is my JSP:





My DynaForm declaration:
-===










/>









type="com.baselogic.yoursos.contact.ContactDto[]" />




My Action Declaration:
===







My AlertActions.java default method: 
public ActionForward defaultMethod( ActionMapping mapping
, ActionForm form
, HttpServletRequest request
, HttpServletResponse response
)
throws AlertNotFoundException, Exception
{
log.info( "Process a AlertActions.defaultMethod()" );
//IUserServices usd = this.getUserService();

AlertDto alertDto = new AlertDto();

//form = setFormDatesToDate( form );
BeanUtils.copyProperties( alertDto, form );
UserDto userDto = this.getUserService().findUser( 
getUserContainer(
request ).getUserLightDto().getUserId() );
ContactDto[] userContacts = userDto.getUserContacts();

log.info( "userContacts[] length: " + userContacts.length );

if( alertDto.getAlertId().equals( "" ) )
{
// Must be a new alert then
log.info( "Must be a new alert then" );
alertDto.setUserId( userDto.getUserId() );
log.info( "alertDto: " + alertDto.toString() );
( ( DynaActionForm ) form ).set( Constants.USER_CONTACTS_KEY,
userContacts );
BeanUtils.copyProperties( form, alertDto );
//form = setFormDatesToString( form );
return ( mapping.findForward( Constants.ADD_FWD ) );
}
log.info( "Must be an existing alert then" );

// Get the required AlertDto...
alertDto = this.getAlertService().findAlert( alertDto.getAlertId()
);
// Do we need to re-set the 2 dates from Dates, into Strings here?
BeanUtils.copyProperties( form, alertDto );
// We need to add the String[] object from our ContactDto[]

return ( mapping.findForward( Constants.VIEW_FWD ) );
}
My AlertActions.java add method: 
public ActionForward add( ActionMapping mapping
  , ActionForm form
  , HttpServletRequest request
  , HttpServletResponse response
  )
throws Exception
{
try
{
if( log.isInfoEnabled() )
{
log.info( "Process a alert add(...)" );
log.info( "alertForm::add(): " + form.toString() );
}
IAlertServices asd = this.getAlertService();

UserLightDto userlightDto = getUserContainer( request
).getUserLightDto();
// We are forced to take a String as a Date, then reformat it 
to

a Date when we add or modify it.
form = setFormDatesToDate( form );
AlertDto alertDto = new AlertDto();
BeanUtils.copyProperties( alertDto, form );
if( log.isInfoEnabled() )
{
log.info( "alertUpdate.dto: " + alertDto.toString() );
}
if( alertDto.getAlertId().equals( "" ) )
{
// Must be a new alert thenadd it
log.info( "Must be a new alert thenAdd it" );
// First we need to create the ContactDto objects from our
String[]
String[] alertContacts = (String[])( (DynaActionForm) form
).get( Constants.ALERT_CONTACTS_KEY );
// We first have to create the alert. Then, only after
creation, can we add th

Re: DateUtilities for ActionForms?

2003-06-01 Thread Gareth Andrew
Mick,

Have you tried using the BeanUtils converters. 
From the docs:

*org.apache.commons.beanutils.locale.converters.DateLocaleConverter
*
Standard |LocaleConverter| <cid:[EMAIL PROTECTED]> 
implementation that converts an incoming locale-sensitive String into a 
|java.util.Date| object, optionally using a default value or throwing a 
|ConversionException| <cid:[EMAIL PROTECTED]> if a 
conversion error occurs.

It sounds like it might help, but I haven't used it before so i can't 
comment.  At the very least the source might be useful if you decide you 
need to write your own DateUtilities.

HTH.

Gareth.

Mick Knutson wrote:

Is there already a set of DateUtilities for ActionForms?
I am finding myself converting to and from Strings and also 
reformating my Dates to and from my DB.

I am using EntityBeans and ValueObjects with my ActionForms, so to 
keep the types in synch, it seems I have to do serious conversion all 
the time.
Thanks in advance for the help.

---
Thanks...
Mick Knutson
---
_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

-
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: DateUtilities for ActionForms?

2003-06-01 Thread Mark Galbreath
try changing



to



Mark

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 12:35 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?


Here is my JSP:






My DynaForm declaration:
-===


























My Action Declaration:
===









My AlertActions.java default method: 
public ActionForward defaultMethod( ActionMapping mapping
, ActionForm form
, HttpServletRequest request
, HttpServletResponse response
)
throws AlertNotFoundException, Exception
{
log.info( "Process a AlertActions.defaultMethod()" );

//IUserServices usd = this.getUserService();

AlertDto alertDto = new AlertDto();

//form = setFormDatesToDate( form );
BeanUtils.copyProperties( alertDto, form );

UserDto userDto = this.getUserService().findUser( getUserContainer( 
request ).getUserLightDto().getUserId() );
ContactDto[] userContacts = userDto.getUserContacts();

log.info( "userContacts[] length: " + userContacts.length );

if( alertDto.getAlertId().equals( "" ) )
{
// Must be a new alert then
log.info( "Must be a new alert then" );
alertDto.setUserId( userDto.getUserId() );
log.info( "alertDto: " + alertDto.toString() );

( ( DynaActionForm ) form ).set( Constants.USER_CONTACTS_KEY, 
userContacts );
BeanUtils.copyProperties( form, alertDto );
//form = setFormDatesToString( form );

return ( mapping.findForward( Constants.ADD_FWD ) );
}

log.info( "Must be an existing alert then" );

// Get the required AlertDto...
alertDto = this.getAlertService().findAlert( alertDto.getAlertId() 
);

// Do we need to re-set the 2 dates from Dates, into Strings here?
BeanUtils.copyProperties( form, alertDto );

// We need to add the String[] object from our ContactDto[]

return ( mapping.findForward( Constants.VIEW_FWD ) );
}


My AlertActions.java add method: 
public ActionForward add( ActionMapping mapping
  , ActionForm form
  , HttpServletRequest request
  , HttpServletResponse response
  )
throws Exception
{
try
{
if( log.isInfoEnabled() )
{
log.info( "Process a alert add(...)" );
log.info( "alertForm::add(): " + form.toString() );
}

IAlertServices asd = this.getAlertService();

UserLightDto userlightDto = getUserContainer( request 
).getUserLightDto();

// We are forced to take a String as a Date, then reformat it to

a Date when we add or modify it.
form = setFormDatesToDate( form );

AlertDto alertDto = new AlertDto();
BeanUtils.copyProperties( alertDto, form );

if( log.isInfoEnabled() )
{
log.info( "alertUpdate.dto: " + alertDto.toString() );
}

if( alertDto.getAlertId().equals( "" ) )
{
// Must be a new alert thenadd it
log.info( "Must be a new alert thenAdd it" );

// First we need to create the ContactDto objects from our 
String[]
String[] alertContacts = (String[])( (DynaActionForm) form 
).get( Constants.ALERT_CONTACTS_KEY );

// We first have to create the alert. Then, only after 
creation, can we add the contacts.
alertDto = asd.alertCreate( alertDto );

log.info( "String[] alertContacts length: " + 
alertContacts.length );
setAlertContactsFromForm( alertDto, alertContacts );
alertDto = asd.alertUpdate( alertDto );
return ( mapping.findForward( Constants.SUCCESS_FWD ) );
}

// Forward control to the specified success URI
return ( mapping.findForward( Constants.SUCCESS_FWD ) );
}
catch( Exception e )
{
log.error( "Exception adding alert; " + e.getMessage(), e );

RE: DateUtilities for ActionForms?

2003-06-01 Thread Mick Knutson
Here is my JSP:


   


My DynaForm declaration:
-===
   
   
   
   

   

   
   
   

   

   
   
   
   

   
   
   
   
   

My Action Declaration:
===
   


   
   

   
My AlertActions.java default method:

   public ActionForward defaultMethod( ActionMapping mapping
   , ActionForm form
   , HttpServletRequest request
   , HttpServletResponse response
   )
   throws AlertNotFoundException, Exception
   {
   log.info( "Process a AlertActions.defaultMethod()" );
   //IUserServices usd = this.getUserService();

   AlertDto alertDto = new AlertDto();

   //form = setFormDatesToDate( form );
   BeanUtils.copyProperties( alertDto, form );
   UserDto userDto = this.getUserService().findUser( getUserContainer( 
request ).getUserLightDto().getUserId() );
   ContactDto[] userContacts = userDto.getUserContacts();

   log.info( "userContacts[] length: " + userContacts.length );

   if( alertDto.getAlertId().equals( "" ) )
   {
   // Must be a new alert then
   log.info( "Must be a new alert then" );
   alertDto.setUserId( userDto.getUserId() );
   log.info( "alertDto: " + alertDto.toString() );
   ( ( DynaActionForm ) form ).set( Constants.USER_CONTACTS_KEY, 
userContacts );
   BeanUtils.copyProperties( form, alertDto );
   //form = setFormDatesToString( form );

   return ( mapping.findForward( Constants.ADD_FWD ) );
   }
   log.info( "Must be an existing alert then" );

   // Get the required AlertDto...
   alertDto = this.getAlertService().findAlert( alertDto.getAlertId() 
);

   // Do we need to re-set the 2 dates from Dates, into Strings here?
   BeanUtils.copyProperties( form, alertDto );
   // We need to add the String[] object from our ContactDto[]

   return ( mapping.findForward( Constants.VIEW_FWD ) );
   }
My AlertActions.java add method:

   public ActionForward add( ActionMapping mapping
 , ActionForm form
 , HttpServletRequest request
 , HttpServletResponse response
 )
   throws Exception
   {
   try
   {
   if( log.isInfoEnabled() )
   {
   log.info( "Process a alert add(...)" );
   log.info( "alertForm::add(): " + form.toString() );
   }
   IAlertServices asd = this.getAlertService();

   UserLightDto userlightDto = getUserContainer( request 
).getUserLightDto();

   // We are forced to take a String as a Date, then reformat it to 
a Date when we add or modify it.
   form = setFormDatesToDate( form );

   AlertDto alertDto = new AlertDto();
   BeanUtils.copyProperties( alertDto, form );
   if( log.isInfoEnabled() )
   {
   log.info( "alertUpdate.dto: " + alertDto.toString() );
   }
   if( alertDto.getAlertId().equals( "" ) )
   {
   // Must be a new alert thenadd it
   log.info( "Must be a new alert thenAdd it" );
   // First we need to create the ContactDto objects from our 
String[]
   String[] alertContacts = (String[])( (DynaActionForm) form 
).get( Constants.ALERT_CONTACTS_KEY );

   // We first have to create the alert. Then, only after 
creation, can we add the contacts.
   alertDto = asd.alertCreate( alertDto );

   log.info( "String[] alertContacts length: " + 
alertContacts.length );
   setAlertContactsFromForm( alertDto, alertContacts );
   alertDto = asd.alertUpdate( alertDto );
   return ( mapping.findForward( Constants.SUCCESS_FWD ) );
   }

   // Forward control to the specified success URI
   return ( mapping.findForward( Constants.SUCCESS_FWD ) );
   }
   catch( Exception e )
   {
   log.error( "Exception adding alert; " + e.getMessage(), e );
   throw e;
   }
   }


My XDoclet Generated ValueObject:
===
/*
* Generated file - Do not edit!
*/
package com.baselogic.yoursos.alert;
import java.util.*;

/**
* Value object for Alert.
*
* @xdoclet-generated at 31-05-03
* @copyright YourSOS
* @author mknutson
* @version xxx
*/
public class AlertDto
  extends java.lang.Object
  implements java.io.Serializable
{
  private java.lang.String alertId;
  private boolean alertIdHasBeenSet

RE: DateUtilities for ActionForms?

2003-06-01 Thread Mark Galbreath
Post the relevant code and let's see what we can do...

Mark

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 12:12 PM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?


Then why are the months hard-coded?

I am really just having a huge issue with my ValueObject having a 
java.util.Date, and my DynaForm seemingly needing a String, then converting 
the String to a Date before copying it to the ValueObject.

I was suppose to deliver this Friday, but the Dates are kicking my butt.



---
Thanks...
Mick Knutson
---





>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Sat, 31 May 2003 11:32:53 -0400
>
>java.util.Calendar has built-in locale conversions and takes a variety 
>of input formats - it's really a pretty versatile class.
>
>Mark
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Saturday, May 31, 2003 11:21 AM
>To: [EMAIL PROTECTED]
>Subject: RE: DateUtilities for ActionForms?
>
>
>OK, But my dates are international, and I do not know which of 
>potentially several formats they may need to be in to support my fully 
>Internationalized
>
>application.
>Such as the use of "Jan, Feb...etc..." would never work in this 
>context.
>
>
>
>---
>Thanks...
>Mick Knutson
>---
>
>
>
>
>
> >From: "Mark Galbreath" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" 
> ><[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Subject: RE: DateUtilities for ActionForms?
> >Date: Fri, 30 May 2003 09:18:18 -0400
> >
> >I wrote a simple conversion method and pass the Strings through - no 
> >hassle at all. Given the String "Jan 1, 2003":
> >
> >Calendar date = getDate( string );
> >
> >private Calendar getDate( String string ) {
> >   Calender cal = Calender.getInstance();
> >   String formatted_date = null;
> >   String[] months = { 
> >"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","De
> >c"
>};
> >   StringTokenizer st = new StringTokenizer( string );
> >   String str = st.nextToken();
> >
> >   for( int i; i < months.length; i++ ) {
> >
> > if( str.equalsIgnoreCase( months[ i ] )) {
> >   month = i;
> >   break;
> > }
> >   }
> >
> >   String temp = st.nextToken();
> >   StringTokenizer token = new StringTokenizer( temp, "," );
> >   date = ( new Integer(( String ) token.nextElement() )).intValue();
> >   year = ( new Integer(( String ) st.nextElement() )).intValue();
> >
> >   return( cal.set( year, month + 1, date ));
> >}
> >
> >
> >Easy, heh?  You could also use regular expressions if you are using 
> >JDK 1.4.
> >
> >Mark
> >
> >-Original Message-
> >From: Mick Knutson [mailto:[EMAIL PROTECTED]
> >Sent: Friday, May 30, 2003 4:09 AM
> >To: [EMAIL PROTECTED]
> >Subject: DateUtilities for ActionForms?
> >
> >
> >Is there already a set of DateUtilities for ActionForms?
> >I am finding myself converting to and from Strings and also 
> >reformating my Dates to and from my DB.
> >
> >I am using EntityBeans and ValueObjects with my ActionForms, so to 
> >keep the types in synch, it seems I have to do serious conversion all 
> >the time. Thanks in advance for the help.
> >
> >---
> >Thanks...
> >Mick Knutson
> >---
> >
> >_
> >The new MSN 8: smart spam protection and 2 months FREE* 
> >http://join.msn.com/?page=features/junkmail
> >
> >
> >-
> >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]
> >
>
>_
>Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
>http://join.msn.com/?page=features/featuredemail
>
>
>-
>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]
>

_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail


-
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: DateUtilities for ActionForms?

2003-06-01 Thread Mick Knutson
Thanks for sharing. I am working on this right now...



---
Thanks...
Mick Knutson
---




From: Ted Husted <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: DateUtilities for ActionForms?
Date: Sat, 31 May 2003 12:06:58 -0400
I started a helper class here:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/wqdata/wqdata/src/java/shared/org_apache_commons/util/

(DateDisplay) which you might find helpful as a starting point.

It's mainly designed to help move dates back and forth between pulldown 
fields and/or calendar JavaScripts.

It doesn't have a locale field now, but it would be easy to add. Then you

As Mark mentioned, the Java classes do everything you need, so it's mainly 
a matter of wrapping them in a helper class tailored to your needs.

-Ted.

Mick Knutson wrote:
OK, But my dates are international, and I do not know which of potentially 
several formats they may need to be in to support my fully 
Internationalized application.
Such as the use of "Jan, Feb...etc..." would never work in this context.



---
Thanks...
Mick Knutson
---




From: "Mark Galbreath" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: DateUtilities for ActionForms?
Date: Fri, 30 May 2003 09:18:18 -0400
I wrote a simple conversion method and pass the Strings through - no 
hassle
at all. Given the String "Jan 1, 2003":

Calendar date = getDate( string );

private Calendar getDate( String string ) {
  Calender cal = Calender.getInstance();
  String formatted_date = null;
  String[] months = {
"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" 
};
  StringTokenizer st = new StringTokenizer( string );
  String str = st.nextToken();

  for( int i; i < months.length; i++ ) {

if( str.equalsIgnoreCase( months[ i ] )) {
  month = i;
  break;
}
  }
  String temp = st.nextToken();
  StringTokenizer token = new StringTokenizer( temp, "," );
  date = ( new Integer(( String ) token.nextElement() )).intValue();
  year = ( new Integer(( String ) st.nextElement() )).intValue();
  return( cal.set( year, month + 1, date ));
}
Easy, heh?  You could also use regular expressions if you are using JDK 
1.4.

Mark

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Friday, May 30, 2003 4:09 AM
To: [EMAIL PROTECTED]
Subject: DateUtilities for ActionForms?
Is there already a set of DateUtilities for ActionForms?
I am finding myself converting to and from Strings and also reformating 
my
Dates to and from my DB.

I am using EntityBeans and ValueObjects with my ActionForms, so to keep 
the
types in synch, it seems I have to do serious conversion all the time.
Thanks in advance for the help.

---
Thanks...
Mick Knutson
---
_
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
-
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]
_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

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



--
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

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


RE: DateUtilities for ActionForms?

2003-06-01 Thread Mark Galbreath
Nice utils, Ted!  Thanks for sharing.

-Original Message-
From: Ted Husted [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 12:07 PM
To: Struts Users Mailing List
Subject: Re: DateUtilities for ActionForms?


I started a helper class here:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/wqdata/wqdata/src/java/shared
/org_apache_commons/util/

(DateDisplay) which you might find helpful as a starting point.

It's mainly designed to help move dates back and forth between pulldown 
fields and/or calendar JavaScripts.

It doesn't have a locale field now, but it would be easy to add. Then you

As Mark mentioned, the Java classes do everything you need, so it's 
mainly a matter of wrapping them in a helper class tailored to your needs.

-Ted.


Mick Knutson wrote:
> OK, But my dates are international, and I do not know which of
> potentially several formats they may need to be in to support my fully 
> Internationalized application.
> Such as the use of "Jan, Feb...etc..." would never work in this context.
> 
> 
> 
> ---
> Thanks...
> Mick Knutson
> ---
> 
> 
> 
> 
> 
>> From: "Mark Galbreath" <[EMAIL PROTECTED]>
>> Reply-To: "Struts Users Mailing List" 
>> <[EMAIL PROTECTED]>
>> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>> Subject: RE: DateUtilities for ActionForms?
>> Date: Fri, 30 May 2003 09:18:18 -0400
>>
>> I wrote a simple conversion method and pass the Strings through - no
>> hassle
>> at all. Given the String "Jan 1, 2003":
>>
>> Calendar date = getDate( string );
>>
>> private Calendar getDate( String string ) {
>>   Calender cal = Calender.getInstance();
>>   String formatted_date = null;
>>   String[] months = { 
>> "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","De
>> c"
>> };
>>   StringTokenizer st = new StringTokenizer( string );
>>   String str = st.nextToken();
>>
>>   for( int i; i < months.length; i++ ) {
>>
>> if( str.equalsIgnoreCase( months[ i ] )) {
>>   month = i;
>>   break;
>> }
>>   }
>>
>>   String temp = st.nextToken();
>>   StringTokenizer token = new StringTokenizer( temp, "," );
>>   date = ( new Integer(( String ) token.nextElement() )).intValue();
>>   year = ( new Integer(( String ) st.nextElement() )).intValue();
>>
>>   return( cal.set( year, month + 1, date ));
>> }
>>
>>
>> Easy, heh?  You could also use regular expressions if you are using
>> JDK 1.4.
>>
>> Mark
>>
>> -Original Message-
>> From: Mick Knutson [mailto:[EMAIL PROTECTED]
>> Sent: Friday, May 30, 2003 4:09 AM
>> To: [EMAIL PROTECTED]
>> Subject: DateUtilities for ActionForms?
>>
>>
>> Is there already a set of DateUtilities for ActionForms?
>> I am finding myself converting to and from Strings and also
>> reformating my
>> Dates to and from my DB.
>>
>> I am using EntityBeans and ValueObjects with my ActionForms, so to
>> keep the
>> types in synch, it seems I have to do serious conversion all the time.
>> Thanks in advance for the help.
>>
>> ---
>> Thanks...
>> Mick Knutson
>> ---
>>
>> _
>> The new MSN 8: smart spam protection and 2 months FREE* 
>> http://join.msn.com/?page=features/junkmail
>>
>>
>> -
>> 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]
>>
> 
> _
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



-
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: DateUtilities for ActionForms?

2003-06-01 Thread Mick Knutson
Then why are the months hard-coded?

I am really just having a huge issue with my ValueObject having a 
java.util.Date, and my DynaForm seemingly needing a String, then converting 
the String to a Date before copying it to the ValueObject.

I was suppose to deliver this Friday, but the Dates are kicking my butt.



---
Thanks...
Mick Knutson
---




From: "Mark Galbreath" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: DateUtilities for ActionForms?
Date: Sat, 31 May 2003 11:32:53 -0400
java.util.Calendar has built-in locale conversions and takes a variety of
input formats - it's really a pretty versatile class.
Mark

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 11:21 AM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?
OK, But my dates are international, and I do not know which of potentially
several formats they may need to be in to support my fully 
Internationalized

application.
Such as the use of "Jan, Feb...etc..." would never work in this context.


---
Thanks...
Mick Knutson
---




>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Fri, 30 May 2003 09:18:18 -0400
>
>I wrote a simple conversion method and pass the Strings through - no
>hassle at all. Given the String "Jan 1, 2003":
>
>Calendar date = getDate( string );
>
>private Calendar getDate( String string ) {
>   Calender cal = Calender.getInstance();
>   String formatted_date = null;
>   String[] months = {
>"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" 
};
>   StringTokenizer st = new StringTokenizer( string );
>   String str = st.nextToken();
>
>   for( int i; i < months.length; i++ ) {
>
> if( str.equalsIgnoreCase( months[ i ] )) {
>   month = i;
>   break;
> }
>   }
>
>   String temp = st.nextToken();
>   StringTokenizer token = new StringTokenizer( temp, "," );
>   date = ( new Integer(( String ) token.nextElement() )).intValue();
>   year = ( new Integer(( String ) st.nextElement() )).intValue();
>
>   return( cal.set( year, month + 1, date ));
>}
>
>
>Easy, heh?  You could also use regular expressions if you are using JDK
>1.4.
>
>Mark
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Friday, May 30, 2003 4:09 AM
>To: [EMAIL PROTECTED]
>Subject: DateUtilities for ActionForms?
>
>
>Is there already a set of DateUtilities for ActionForms?
>I am finding myself converting to and from Strings and also reformating
>my Dates to and from my DB.
>
>I am using EntityBeans and ValueObjects with my ActionForms, so to keep
>the types in synch, it seems I have to do serious conversion all the
>time. Thanks in advance for the help.
>
>---
>Thanks...
>Mick Knutson
>---
>
>_
>The new MSN 8: smart spam protection and 2 months FREE*
>http://join.msn.com/?page=features/junkmail
>
>
>-
>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]
>

_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
-
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]
_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Re: DateUtilities for ActionForms?

2003-06-01 Thread Ted Husted
I started a helper class here:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/wqdata/wqdata/src/java/shared/org_apache_commons/util/

(DateDisplay) which you might find helpful as a starting point.

It's mainly designed to help move dates back and forth between pulldown 
fields and/or calendar JavaScripts.

It doesn't have a locale field now, but it would be easy to add. Then you

As Mark mentioned, the Java classes do everything you need, so it's 
mainly a matter of wrapping them in a helper class tailored to your needs.

-Ted.

Mick Knutson wrote:
OK, But my dates are international, and I do not know which of 
potentially several formats they may need to be in to support my fully 
Internationalized application.
Such as the use of "Jan, Feb...etc..." would never work in this context.



---
Thanks...
Mick Knutson
---




From: "Mark Galbreath" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: DateUtilities for ActionForms?
Date: Fri, 30 May 2003 09:18:18 -0400
I wrote a simple conversion method and pass the Strings through - no 
hassle
at all. Given the String "Jan 1, 2003":

Calendar date = getDate( string );

private Calendar getDate( String string ) {
  Calender cal = Calender.getInstance();
  String formatted_date = null;
  String[] months = {
"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" 
};
  StringTokenizer st = new StringTokenizer( string );
  String str = st.nextToken();

  for( int i; i < months.length; i++ ) {

if( str.equalsIgnoreCase( months[ i ] )) {
  month = i;
  break;
}
  }
  String temp = st.nextToken();
  StringTokenizer token = new StringTokenizer( temp, "," );
  date = ( new Integer(( String ) token.nextElement() )).intValue();
  year = ( new Integer(( String ) st.nextElement() )).intValue();
  return( cal.set( year, month + 1, date ));
}
Easy, heh?  You could also use regular expressions if you are using 
JDK 1.4.

Mark

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Friday, May 30, 2003 4:09 AM
To: [EMAIL PROTECTED]
Subject: DateUtilities for ActionForms?
Is there already a set of DateUtilities for ActionForms?
I am finding myself converting to and from Strings and also 
reformating my
Dates to and from my DB.

I am using EntityBeans and ValueObjects with my ActionForms, so to 
keep the
types in synch, it seems I have to do serious conversion all the time.
Thanks in advance for the help.

---
Thanks...
Mick Knutson
---
_
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
-
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]
_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

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



--
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>


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


RE: DateUtilities for ActionForms?

2003-06-01 Thread Mark Galbreath
java.util.Calendar has built-in locale conversions and takes a variety of
input formats - it's really a pretty versatile class.

Mark

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 31, 2003 11:21 AM
To: [EMAIL PROTECTED]
Subject: RE: DateUtilities for ActionForms?


OK, But my dates are international, and I do not know which of potentially 
several formats they may need to be in to support my fully Internationalized

application.
Such as the use of "Jan, Feb...etc..." would never work in this context.



---
Thanks...
Mick Knutson
---





>From: "Mark Galbreath" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: DateUtilities for ActionForms?
>Date: Fri, 30 May 2003 09:18:18 -0400
>
>I wrote a simple conversion method and pass the Strings through - no 
>hassle at all. Given the String "Jan 1, 2003":
>
>Calendar date = getDate( string );
>
>private Calendar getDate( String string ) {
>   Calender cal = Calender.getInstance();
>   String formatted_date = null;
>   String[] months = { 
>"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" };
>   StringTokenizer st = new StringTokenizer( string );
>   String str = st.nextToken();
>
>   for( int i; i < months.length; i++ ) {
>
> if( str.equalsIgnoreCase( months[ i ] )) {
>   month = i;
>   break;
> }
>   }
>
>   String temp = st.nextToken();
>   StringTokenizer token = new StringTokenizer( temp, "," );
>   date = ( new Integer(( String ) token.nextElement() )).intValue();
>   year = ( new Integer(( String ) st.nextElement() )).intValue();
>
>   return( cal.set( year, month + 1, date ));
>}
>
>
>Easy, heh?  You could also use regular expressions if you are using JDK
>1.4.
>
>Mark
>
>-Original Message-
>From: Mick Knutson [mailto:[EMAIL PROTECTED]
>Sent: Friday, May 30, 2003 4:09 AM
>To: [EMAIL PROTECTED]
>Subject: DateUtilities for ActionForms?
>
>
>Is there already a set of DateUtilities for ActionForms?
>I am finding myself converting to and from Strings and also reformating 
>my Dates to and from my DB.
>
>I am using EntityBeans and ValueObjects with my ActionForms, so to keep 
>the types in synch, it seems I have to do serious conversion all the 
>time. Thanks in advance for the help.
>
>---
>Thanks...
>Mick Knutson
>---
>
>_
>The new MSN 8: smart spam protection and 2 months FREE* 
>http://join.msn.com/?page=features/junkmail
>
>
>-
>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]
>

_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail


-
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: DateUtilities for ActionForms?

2003-06-01 Thread Mick Knutson
OK, But my dates are international, and I do not know which of potentially 
several formats they may need to be in to support my fully Internationalized 
application.
Such as the use of "Jan, Feb...etc..." would never work in this context.



---
Thanks...
Mick Knutson
---




From: "Mark Galbreath" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: DateUtilities for ActionForms?
Date: Fri, 30 May 2003 09:18:18 -0400
I wrote a simple conversion method and pass the Strings through - no hassle
at all. Given the String "Jan 1, 2003":
Calendar date = getDate( string );

private Calendar getDate( String string ) {
  Calender cal = Calender.getInstance();
  String formatted_date = null;
  String[] months = {
"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" };
  StringTokenizer st = new StringTokenizer( string );
  String str = st.nextToken();
  for( int i; i < months.length; i++ ) {

if( str.equalsIgnoreCase( months[ i ] )) {
  month = i;
  break;
}
  }
  String temp = st.nextToken();
  StringTokenizer token = new StringTokenizer( temp, "," );
  date = ( new Integer(( String ) token.nextElement() )).intValue();
  year = ( new Integer(( String ) st.nextElement() )).intValue();
  return( cal.set( year, month + 1, date ));
}
Easy, heh?  You could also use regular expressions if you are using JDK 
1.4.

Mark

-----Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Friday, May 30, 2003 4:09 AM
To: [EMAIL PROTECTED]
Subject: DateUtilities for ActionForms?
Is there already a set of DateUtilities for ActionForms?
I am finding myself converting to and from Strings and also reformating my
Dates to and from my DB.
I am using EntityBeans and ValueObjects with my ActionForms, so to keep the
types in synch, it seems I have to do serious conversion all the time.
Thanks in advance for the help.
---
Thanks...
Mick Knutson
---
_
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
-
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]
_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

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


RE: DateUtilities for ActionForms?

2003-05-30 Thread Mark Galbreath
I wrote a simple conversion method and pass the Strings through - no hassle
at all. Given the String "Jan 1, 2003":

Calendar date = getDate( string );

private Calendar getDate( String string ) {
  Calender cal = Calender.getInstance();
  String formatted_date = null;
  String[] months = {
"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" };
  StringTokenizer st = new StringTokenizer( string );
  String str = st.nextToken();

  for( int i; i < months.length; i++ ) {

if( str.equalsIgnoreCase( months[ i ] )) {
  month = i;
  break;
}
  }

  String temp = st.nextToken();
  StringTokenizer token = new StringTokenizer( temp, "," );
  date = ( new Integer(( String ) token.nextElement() )).intValue();
  year = ( new Integer(( String ) st.nextElement() )).intValue();

  return( cal.set( year, month + 1, date ));
}


Easy, heh?  You could also use regular expressions if you are using JDK 1.4.

Mark

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 30, 2003 4:09 AM
To: [EMAIL PROTECTED]
Subject: DateUtilities for ActionForms?


Is there already a set of DateUtilities for ActionForms?
I am finding myself converting to and from Strings and also reformating my 
Dates to and from my DB.

I am using EntityBeans and ValueObjects with my ActionForms, so to keep the 
types in synch, it seems I have to do serious conversion all the time.
Thanks in advance for the help.

---
Thanks...
Mick Knutson
---

_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail


-
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]



DateUtilities for ActionForms?

2003-05-30 Thread Mick Knutson
Is there already a set of DateUtilities for ActionForms?
I am finding myself converting to and from Strings and also reformating my 
Dates to and from my DB.

I am using EntityBeans and ValueObjects with my ActionForms, so to keep the 
types in synch, it seems I have to do serious conversion all the time.
Thanks in advance for the help.

---
Thanks...
Mick Knutson
---
_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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