It seems like the only way things work out properly in the rendering phase is to have a ValueObject that contains the Date properties and an ActionForm that has a String for each Date on the ValueObject. This is what I was originally hoping to avoid. My ActionForm contains graphs of ValueObjects that I render using the nested tags. It'd be really painful to come up with a parallel set of ValueObjects that have Strings instead of Dates.
Is there any way to get formatted Dates from the <html:text> and like tags or am I stuck? > -----Original Message----- > From: Jim Krygowski [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 23, 2002 12:24 PM > To: Struts Users Mailing List > Subject: RE: java.util.Dates and Struts > > > Hi Rick- > > I should have deleted the first block of code. It's not exactly > misleading, > but it unfocuses my point. I apologise for that. I'm spread a > little thin > so the email quality control is suffering ;-). > > The key thing to notice is this: > > 1. HashMap values = new HashMap(); > 2. values.put("today", "2002-03-17"); > > 3. MockForm mockForm = new MockForm(); > 4. BeanUtils.copyProperties(mockForm, values); > 5. System.out.println(mockForm.getToday()); > 6. Map beanProps = BeanUtils.describe(mockForm); > 7. System.out.println(beanProps.get("today")); > > > On line 4, the code successfully transforms a String into a Date > and stores > it in the form MockForm. On line 6, I try to get that value out of the > MockForm (where it is stored as a Date) and into beanProps which > is a Map of > the Stringified values of all the getters on MockForm. The date > string that > ends up in beanProps is not formatted. > > jk > > > -----Original Message----- > > From: Rick Reumann [mailto:[EMAIL PROTECTED]] > > Sent: Monday, December 23, 2002 3:07 PM > > Cc: [EMAIL PROTECTED] > > Subject: Re: java.util.Dates and Struts > > > > > > On Mon, 23 Dec 2002 11:49:04 -0500 > > Jim Krygowski <[EMAIL PROTECTED]> wrote: > > > > > This is my test: > > > ... > > > String input = null; > > > > > > // check to make sure the datatype is right > > > input = "2002-03-17"; > > > Date dateValue = (Date)ConvertUtils.convert(input, Date.class); > > > assertTrue(dateValue instanceof Date); > > > > But where is this dateValue being used? You saying it's not converting > > java.util.Date to a String properly for you yet I don't see this Date > > being used anywhere to even allow it be converted to the String in the > > correct format. > > > > > > > > // try to get a value from a Map > > > HashMap values = new HashMap(); > > > values.put("today", "2002-03-17"); > > > MockForm mockForm = new MockForm(); > > > BeanUtils.copyProperties(mockForm, values); > > > > > > Isn't your concern going the other direction that is having you > > stumped? In other words here you are just doing a String to String > > conversion. Why don't you create a Bean that has java.util.Date field > > and then do > > BeanUtils.copyProperties(mockForm, theObjectThatHasAdateField ); > > Then try > > > > > Map beanProps = BeanUtils.describe(mockForm); > > > System.out.println(beanProps.get("today")); > > > > > > > > -- > > Rick > > > > -- > > 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]>

