How can I have struts put a java.util.Date object into a Bean?

I have found that I can set a Timestamp object into a bean.  THIS DOES WORK
(below).  However, if I change the type on the bean to java.util.Date then I
get a stack trace (also below).  I've also tried different formatting like:
value="Sat Jan 01 00:00:00 EST 2005".  Any hints?  Thanks.

Mark


class MyBean {
  private java.sql.Timestamp myDate;

  public setMyDate(java.sql.Timestamp myDate) {
        this.myDate = myDate;
  }
}

<input type="hidden" name="myDate" value="2005-01-01 00:00:00.0">





java.lang.IllegalArgumentException: argument type mismatch
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j
ava:1789)
        at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
ava:1684)
        at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:17
13)
        at 
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
        at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
        at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
        at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821)
        at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
        at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:263)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:200)
        at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:2390)
        at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:1959)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to