• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

beanutils.ConversionException

 
Ranch Hand
Posts: 111
Eclipse IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
That's a very big dog. I think I want to go home now and hug this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic