struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <maill...@reumann.net>
Subject Re: java.util.Dates and Struts
Date Mon, 23 Dec 2002 20:07:02 GMT
On Mon, 23 Dec 2002 11:49:04 -0500
Jim Krygowski <james.krygowski@shaws.com> 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:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message