RE: Storing date & time stamp within html form

2002-04-30 Thread Leonardo Maciel

I use two variables on the form with respective get/set methods,

Timestamp timestampDate;
String stringDate;

The user enter the date on the String field.
On validate() method on the form I convert from String to Timestamp.
If there is an exception the user gets invalid date format message,
otherwise the Timestamp is populated, the action called, ...

Curious to hear other approaches,
Leo


-Original Message-
From: Hair, Jeffrey [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 10:00 AM
To: 'Struts Users Mailing List'
Subject: RE: Storing date & time stamp within html form


I currently have an object (the ActionForm) that contains the Timestamp
object and it is stored in the request. The problem comes when submiting the
form to populate the Timestamp via struts. Struts throws an exception from
Beans.populate because struts doesn't handle dates.

How are other people processing dates via struts?

jsh

-Original Message-
From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 5:04 PM
To: 'Struts Users Mailing List'
Subject: RE: Storing date & time stamp within html form
Importance: Low


I can think of a couple of ways:

1.  Store your dateCreated object as a request or session attribute and
access it from your action form;

2.  Pass it as a string and use the java.sql.Timestamp.valueOf() method to
change it back to a Timestamp.

Mark

-Original Message-
From: Hair, Jeffrey [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 2:49 PM
To: Struts User Mailing List (E-mail)
Subject: Storing date & time stamp within html form


I'm trying to preserve the date & time stamp of an object by storing the
value in an html element and have struts automatically populate my
ActionForm object with the value upon submit.

Specifically, I have an object of type java.sql.Timestamp contained within
my ActionForm. My jsp code is this:




...



This works fine for writing the hidden html but an exception is thrown when
the form is submitted. I'm looking into using jakarta's Datetime taglib in
combination with struts.

Has anyone else crossed this that is able to give an example or a direction
that will work? Unfortunately, changing my ActionForm attribute to be of
type String instead of Date is not an option.

Thanx,
jsh

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

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

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

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




RE: Storing date & time stamp within html form

2002-04-30 Thread Hair, Jeffrey

I currently have an object (the ActionForm) that contains the Timestamp
object and it is stored in the request. The problem comes when submiting the
form to populate the Timestamp via struts. Struts throws an exception from
Beans.populate because struts doesn't handle dates.

How are other people processing dates via struts?

jsh

-Original Message-
From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 5:04 PM
To: 'Struts Users Mailing List'
Subject: RE: Storing date & time stamp within html form
Importance: Low


I can think of a couple of ways:

1.  Store your dateCreated object as a request or session attribute and
access it from your action form;

2.  Pass it as a string and use the java.sql.Timestamp.valueOf() method to
change it back to a Timestamp.

Mark

-Original Message-
From: Hair, Jeffrey [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 2:49 PM
To: Struts User Mailing List (E-mail)
Subject: Storing date & time stamp within html form


I'm trying to preserve the date & time stamp of an object by storing the
value in an html element and have struts automatically populate my
ActionForm object with the value upon submit.

Specifically, I have an object of type java.sql.Timestamp contained within
my ActionForm. My jsp code is this:




...



This works fine for writing the hidden html but an exception is thrown when
the form is submitted. I'm looking into using jakarta's Datetime taglib in
combination with struts.

Has anyone else crossed this that is able to give an example or a direction
that will work? Unfortunately, changing my ActionForm attribute to be of
type String instead of Date is not an option.

Thanx,
jsh

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

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

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




Re: Storing date & time stamp within html form

2002-04-29 Thread James A. Hillyerd

I haven't tried this myself, but Timestamp has setTime and getTime
methods which handle the time as the milliseconds since the epoch (a
long).  You could probably do something along the lines of:



However, you would have to make sure that you placed an instance of
Timestamp into dateCreated upon reset() of your action form.

-james

-- 
[]  James A. Hillyerd <[EMAIL PROTECTED]> - Java Software Engineer
[]  PGP 1024D/D31BC40D F87B 7906 C0DA 32E8 B8F6 DE23 FBF6 4712 D31B C40D


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Storing date & time stamp within html form

2002-04-29 Thread Galbreath, Mark

I can think of a couple of ways:

1.  Store your dateCreated object as a request or session attribute and
access it from your action form;

2.  Pass it as a string and use the java.sql.Timestamp.valueOf() method to
change it back to a Timestamp.

Mark

-Original Message-
From: Hair, Jeffrey [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 2:49 PM
To: Struts User Mailing List (E-mail)
Subject: Storing date & time stamp within html form


I'm trying to preserve the date & time stamp of an object by storing the
value in an html element and have struts automatically populate my
ActionForm object with the value upon submit.

Specifically, I have an object of type java.sql.Timestamp contained within
my ActionForm. My jsp code is this:




...



This works fine for writing the hidden html but an exception is thrown when
the form is submitted. I'm looking into using jakarta's Datetime taglib in
combination with struts.

Has anyone else crossed this that is able to give an example or a direction
that will work? Unfortunately, changing my ActionForm attribute to be of
type String instead of Date is not an option.

Thanx,
jsh

--
To unsubscribe, e-mail:

For additional commands, e-mail:


--
To unsubscribe, e-mail:   
For additional commands, e-mail: