I have a FormBean that has all strings as the datatypes. I then have a DTO bean that has the "proper" datatypes for the different properties - java.sql.Date, int, etc.
In my JSP form I have an input field that is supposed to represent a date field. It is not a required field. I'm not using the Validator framework. <html:text property="assignedDate" size="12"/> So, when the form is submitted with the assignedDate field have not been set, the value in the FormBean is the empty string "". After validating the fields in the FormBean, I call BeanUtils.copyProperties() to move the values from the FormBean into the DTO but I get a ConversionException on this empty field. I've attached the exception report below. If I fill in the field with a properly formed date then everything works fine. It is only when I leave the field empty that I get the exception. Am I doing something I shouldn't? Just as an empty string field is valid and handled properly, I feel that an empty date field is valid and should be handled properly. How can I fix it? I could check the value of the date fields and if they are empty then I could set them to null (which SqlDateConverter handles correctly) but this is a hack! I could also register my own converter that handles an empty string for input but I feel that this is such a common use case for input date strings I'm confused that it isn't handled. Thanks for any help, Kevin. org.apache.commons.beanutils.ConversionException at org.apache.commons.beanutils.converters.SqlDateConverter.convert(SqlDateConverter.java:162) at org.apache.commons.beanutils.BeanUtils.copyProperty(BeanUtils.java:359) at org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:265) at com.illuminat.cml.LoanRequestSaveAction.execute(LoanRequestSaveAction.java:130) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at com.illuminat.cml.IdentityFilter.doFilter(IdentityFilter.java:101) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:527) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1040) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151) at java.lang.Thread.run(Thread.java:536) Caused by: java.lang.IllegalArgumentException at java.sql.Date.valueOf(Date.java:100) at org.apache.commons.beanutils.converters.SqlDateConverter.convert(SqlDateConverter.java:157) ... 42 more __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>