Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

beanutils.ConversionException

 
Fernando Dominguez
Ranch Hand
Posts: 106
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic