Date attribute in ActionForm
Hello, I have and ActionForm with one element refering to a Date (from Util) property and I get the following exception java.lang.IllegalArgumentException: argument type mismatch Is there a special treatment for these kind of attributes? Thanks, _ Vanessa Monteiro Analista de Sistemas Quality Software 3475-3000 r:5062 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Date attribute in ActionForm
Bean utils (what struts uses in this case) sucks when it comes to parsing anything but Strings. Generally what I do is make put String getter/setter methods on the Form, then in those (or in the Action) use a SimpleDateFormat to parse the string into a date. One other thing to note there is that the date format MM/dd/yy will parse 1/1/04 as 01/01/2004, but 1/1/4 as 01/01/0004, so you need to handle that yourself. Same trick with numeric classes. Larry [EMAIL PROTECTED] 03/02/04 11:36 AM Hello, I have and ActionForm with one element refering to a Date (from Util) property and I get the following exception java.lang.IllegalArgumentException: argument type mismatch Is there a special treatment for these kind of attributes? Thanks, _ Vanessa Monteiro Analista de Sistemas Quality Software 3475-3000 r:5062 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Date attribute in ActionForm
Its also usually the case with dates that downs make less work for the user. This along with beanutils conversions hassles mean s its usually easier to have a day, month , year properties of type String or Integer which then you use to create a Date or Calendar object before passing up to your model or even have gets and sets in you model that do the conversion. On 2 Mar 2004, at 20:03, Larry Meadors wrote: Bean utils (what struts uses in this case) sucks when it comes to parsing anything but Strings. Generally what I do is make put String getter/setter methods on the Form, then in those (or in the Action) use a SimpleDateFormat to parse the string into a date. One other thing to note there is that the date format MM/dd/yy will parse 1/1/04 as 01/01/2004, but 1/1/4 as 01/01/0004, so you need to handle that yourself. Same trick with numeric classes. Larry [EMAIL PROTECTED] 03/02/04 11:36 AM Hello, I have and ActionForm with one element refering to a Date (from Util) property and I get the following exception java.lang.IllegalArgumentException: argument type mismatch Is there a special treatment for these kind of attributes? Thanks, _ Vanessa Monteiro Analista de Sistemas Quality Software 3475-3000 r:5062 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]