aspose file tools*
The moose likes Struts and the fly likes beanutils.ConversionException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "beanutils.ConversionException" Watch "beanutils.ConversionException" New topic
Author

beanutils.ConversionException

Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 102

Where is the problem?

Here is the form.

import java.sql.Date;
import java.util.Vector;

public class InsertarForm extends ActionForm{
private Date fechaPublicacion;
private Date fechaFin;
}

the jsp.

<html:form action="insertar.do">

<td width="125" valign="top"><input name="fechaPublicacion" type="text" class="campo"></td>
<td valign="top"><input name="fechaFin" type="text" class="campo"></td>

</html:form>

struts-config

<action path="/insertar" type="stasacion.novedades.Insertar" name="InsertarForm">

Exception

(catalina.core.StandardWrapperValve:invoke) Servlet.service() para servlet action lanz� excepci�n
org.apache.commons.beanutils.ConversionException
at org.apache.commons.beanutils.converters.SqlDateConverter.convert(SqlDateConverter.java:162)
at org.apache.commons.beanutils.ConvertUtils.convert(ConvertUtils.java:379)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1001)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The commons BeanUtils used by Struts will not convert a date to a String and visa versa. Your ActionForm must represent the dates as Strings, not java.util.Date objects. If you want to use java.util.Date in your model classes, that's fine, but you must write your own code to convert between String and java.util.Date.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: beanutils.ConversionException