File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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


Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 104

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="">

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



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


(catalina.core.StandardWrapperValve:invoke) Servlet.service() para servlet action lanz� excepci�n
at org.apache.commons.beanutils.converters.SqlDateConverter.convert(
at org.apache.commons.beanutils.ConvertUtils.convert(
at org.apache.commons.beanutils.BeanUtils.setProperty(
at org.apache.commons.beanutils.BeanUtils.populate(
at org.apache.struts.util.RequestUtils.populate(
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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: beanutils.ConversionException
It's not a secret anymore!