Dates and Struts

2001-08-22 Thread Matt Raible

Is it true that Struts cannot handle a java.sql.Date or java.util.Date
datatype?  I seem to get errors everytime I try to have one in my form.

Thanks,

Matt

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


RE: Dates and Struts

2001-08-22 Thread Ben Jessell

Yes - I've looked at the code and it doesn't. Best bet is to have a String
injector/selector, then validate this in the validate() method of the form.
The way I have done it is to have 'String only' injectors/selectors,
validate the fields in validate() method of the form, then write a procedure
'toBean' in my form, which is called by perform() in my Action class, which
returns a representation of my form with the correct types.

-Original Message-
From: Matt Raible [mailto:[EMAIL PROTECTED]]
Sent: 22 August 2001 12:39
To: [EMAIL PROTECTED]
Subject: Dates and Struts


Is it true that Struts cannot handle a java.sql.Date or java.util.Date
datatype?  I seem to get errors everytime I try to have one in my form.

Thanks,

Matt

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


=**

If you are not the intended recipient, employee or agent responsible for delivering 
the message to the intended recipient, you are hereby notified that any dissemination 
or copying of this communication and its attachments is strictly prohibited.

If you have received this communication and its attachments in error, please return 
the original message and attachments to the sender using the reply facility on e-mail.

Internet communications are not secure and therefore the UCLES Group does not accept 
legal responsibility for the contents of this message.  Any views or opinions 
presented are solely those of the author and do not necessarily represent those of the 
UCLES Group unless otherwise specifically stated.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses although this does not guarantee that 
this email is virus free.

**=



FW: Dates and Struts

2001-08-22 Thread Ben Jessell



-Original Message-
From: Ben Jessel 
Sent: 22 August 2001 12:44
To: '[EMAIL PROTECTED]'
Subject: RE: Dates and Struts


Yes - I've looked at the code and it doesn't. Best bet is to have a String
injector/selector, then validate this in the validate() method of the form.
The way I have done it is to have 'String only' injectors/selectors,
validate the fields in validate() method of the form, then write a procedure
'toBean' in my form, which is called by perform() in my Action class, which
returns a representation of my form with the correct types.

-Original Message-
From: Matt Raible [mailto:[EMAIL PROTECTED]]
Sent: 22 August 2001 12:39
To: [EMAIL PROTECTED]
Subject: Dates and Struts


Is it true that Struts cannot handle a java.sql.Date or java.util.Date
datatype?  I seem to get errors everytime I try to have one in my form.

Thanks,

Matt

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


=**

If you are not the intended recipient, employee or agent responsible for delivering 
the message to the intended recipient, you are hereby notified that any dissemination 
or copying of this communication and its attachments is strictly prohibited.

If you have received this communication and its attachments in error, please return 
the original message and attachments to the sender using the reply facility on e-mail.

Internet communications are not secure and therefore the UCLES Group does not accept 
legal responsibility for the contents of this message.  Any views or opinions 
presented are solely those of the author and do not necessarily represent those of the 
UCLES Group unless otherwise specifically stated.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses although this does not guarantee that 
this email is virus free.

**=



Re: Dates and Struts

2001-08-22 Thread Gregor Rayman

Matt Raible [EMAIL PROTECTED] wrote:


 Is it true that Struts cannot handle a java.sql.Date or java.util.Date
 datatype?  I seem to get errors everytime I try to have one in my form.

 Thanks,

 Matt

No it cannot. Date is not so easy to parse since it is locale dependent.
Also the displaying a date is not easy.

This brings me to one general architecture question:

Where do you (I mean all struts users) put the formatting/parsingĀ“of
values?

For display only data, I try to put it into the JSP (with custom tags).

But what about the editable data? Is the ActionForm the right place?

I store the data in non-string form (like Date) and the get/set methods
operate with strings. The language dependent formats use an addiotional
property locale which I set either in the reset() method (from request
and session).

It could be done simpler, I used only string aware ActionForms and the
whole formatting were done in Action.perform, but this wouldn't be conform
with the MVC pattern, woul'd it?

--
gR




RE: Dates and Struts

2001-08-22 Thread Ravindran Ramaiah

We have developed a utility class for Date manipulation.
Attached the java file.

Hope this helps.
Thanks
Ravi


-Original Message-
From: Gregor Rayman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 8:01 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Dates and Struts


Matt Raible [EMAIL PROTECTED] wrote:


 Is it true that Struts cannot handle a java.sql.Date or java.util.Date
 datatype?  I seem to get errors everytime I try to have one in my form.

 Thanks,

 Matt

No it cannot. Date is not so easy to parse since it is locale dependent.
Also the displaying a date is not easy.

This brings me to one general architecture question:

Where do you (I mean all struts users) put the formatting/parsingĀ“of
values?

For display only data, I try to put it into the JSP (with custom tags).

But what about the editable data? Is the ActionForm the right place?

I store the data in non-string form (like Date) and the get/set methods
operate with strings. The language dependent formats use an addiotional
property locale which I set either in the reset() method (from request
and session).

It could be done simpler, I used only string aware ActionForms and the
whole formatting were done in Action.perform, but this wouldn't be conform
with the MVC pattern, woul'd it?

--
gR


 StrutsDate.java