My current project uses something like this, but with wrapper class around Calendar (since Date.day/month/year is deprecated). Also makes it easier once you start to use TimeZone and Locale.

BAL

From: Bill Schneider <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: best practice: date widget

What is the best-practice with Struts for making something like an HTML
date-widget control, that has three different input fields but maps to a
java.util.Date in a form bean?  The idea is I want to be able to put
something like

<html:date property="startDate"/>

in a JSP page, and call "Date d = formBean.getStartDate()" from a Java
action.  The output HTML should look like

<select name="startDate.month">
  <option value="1">January</option>
  ...
</select>
<input type="text" name="startDate.day">
<input type="text" name="startDate.year">

and there should be a way to validate to make sure this is a valid date
(February 31 not allowed.)

Any ideas would be appreciated. Thanks!

-- Bill



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



Reply via email to