I'm not sure if Struts takes care of automatic conversions, but you should
only be counting on that behavior if you are doing client-side input
validation.  Otherwise if the user inputs, say, an invalid Date, the
conversion will fail.  There might also be a problem with automatic
conversions if the user doesn't input anything (for example, passing an
empty string to the java.math.BigDecimal construct causes an exception to be
thrown), but again I'm not sure.

I think it is a Struts best practice to use only String and String[]
properties.

Hope this helps,

Matt
----- Original Message -----
From: "Karikalan Kumaresan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 09, 2003 10:14 AM
Subject: Trouble in mapping the request params to Form bean!


> Hi,
>
> I am using Struts 1.1, and having a Form bean which has different type of
> properties (Integer, String, Date), as far as I know, struts takes care of
> the automatic type conversion of the bean properties, but I am getting the
> following error.... am I missing something here, any help would be greatly
> appreciated.
>
> java.lang.IllegalArgumentException: argument type mismatch
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> ) at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at
>
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j
> ava:1789) at
>
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
> ava:1684) at
>
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:17
> 13) at
> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019) at
> org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at
>
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
> ava:821) at
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
> at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
> at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
> and it is running in tomcat 4.1.24
>
> Thanks,
> Karikalan
>
> ---------------------------------------------------------------------
> 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]

Reply via email to