Rick,

You are on the right track. A suggestion would be to break the month, day
and year out on your forms (makes nice-nice with html:select) and provide
the code to populate them in your form instance. The conversion is actually
quite simple:

public GregorianCalendar getStartDate()
{
  return new GregorianCalendar( this.getStartYear(), this.getStartMonth()-1,
this.getStartDay() );
}

This getter (exists in the same form instance) will hand off the startDate
as a java.util.Date to your (dyn)Action.

HTH

Brian

----- Original Message -----
From: "Rick Reumann" <[EMAIL PROTECTED]>
To: "Struts List" <[EMAIL PROTECTED]>
Sent: Wednesday, October 16, 2002 12:22 PM
Subject: Am I the only one using java.util.Date?


> My business layer bean has a field as java.util.Date (example:
> birthDate). My form bean uses the String for this date (in this
> example.. String birthDate). The problem is I can't seem to use
> BeanUtils to copy the properties since it appears BeanUtils will only
> convert a java.sql.Date by default (get
> java.lang.IllegalArgumentException: argument type mismatch when using
> java.util.Date) . I tried dealing with registering a custom Coverter I
> wrote and registering it with ConvertUtils and below is a copy of the
> message I posted concerning this problem.
>
> I'm posting this question, though, because I'm curious how others have
> dealt with this situation? Maybe using the BeanUtils or PropertyUtils
> is not that common of a practice or most use a java.sql.Date as
> opposed to java.util.Date? Having dates in form fields is common so
> I'm curious how others transfer their form field dates to their
> business model (as java.util.Date?).
>
> Thanks for any info.
>



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

Reply via email to