I modified the formbean and action class to accept a date string and it work

Thanks Thanks Thanks.....

Sincerely,


Paul Idusogie

Email: [EMAIL PROTECTED]
Tel: 651.714.8779


-----Original Message-----
From: Rick Reumann [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 06, 2003 12:42 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Cc: Samir Shah
Subject: Re: Please Help! Nested form property attributes.




On Monday, January 6, 2003, 12:44:38 PM, Paul wrote:

PI> rootCause

PI> java.lang.IllegalArgumentException: argument type mismatch at
PI> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
PI>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
 <snip>

PI> What do I do?

enrollDate should be a String in your formBean. Are you sure you
aren't trying setting enrollDate as a Date type in your form bean?

I cc'd Samir as well, since I think he is having similar problems. I
think it's nice and clean to deal with Dates in forms this way:

1) Have a form bean with all Strings representing your jsp form. So
something like birthDate would be set up as a String.

2) Have a business bean with the correct data types. For example..
java.util.Date birthDate, double someNumber, etc.

3) When you submit your jsp page to your action you can take care of
the conversion of the FormBean(all Strings) to the correct data types
and populate your business bean (usually called a DTO or ValueObject).
Similarly, when going the other direction you can take a business bean
and convert the Date fields into Strings (with the format you like)
and populate your FormBean and display that to the user.

As far as doing the conversion I usually take care of that outside of
the Action and use the BeanUtils.copyProperties(..) but you can also
just create your own helper class to do the conversions for you if you
like.


--

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

Reply via email to