Oddly enough, I was going to write about how to handle this in my blog today.  What I 
do to manage this is to use an object that wraps a java.util.Date and provides getters 
and setters for the necessary fields, such as hour, minute, day, month, and year.  
Such an object might look like:

public class DateWrapper {

  private Date d;

  public DateWrapper(Date d) {
    internal = d;
  }

  public Date getDate() {
    // return the updated Date instance.
  }
  
  public int getHour() {
    // return the hour as an int, either using a Calendar instance or
        //  by parsing it out via SimpleDateFormat.
  }

  public void setHour(int hour) {
    // set the hour in the date using a Calendar instance.  
  }

}

I'm sure you can figure out the rest of it.

The DateWrapper object is then used as a field in your ActionForm or DynaForm.  Then, 
in the JSP, just use the appropriate property names in your <html:select> lists:

<html:select property="startDate.hour">
...
</html:select>

<html:select property="startDate.minute">
...
</html:select>

If you just want to present the underlying Date instance, just do something like this:

<fmt:formatDate value="${myForm.map.startDate.date}" pattern="yyyy-MM-dd h:m a"/>

Hope that helps.  This is the same mechanism I use and I'm having great results with 
it.

-- 
Nick Heudecker
SystemMobile, Inc.
Email: [EMAIL PROTECTED]
Web: http://www.systemmobile.com

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

Reply via email to