You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Neal Haggard <Ne...@sas.com> on 2005/08/15 20:54:32 UTC

Using java.sql.Timestamp with a Calendar component?

Any idea how to handle using a java.sql.Timestamp object in the inputCalendar component.  Here's our JSP code:

<t:inputCalendar id="date" renderAsPopup="true"
			renderPopupButtonAsImage="true" value="#{event.currentDate}" />

Our event has the following:

     public java.sql.Timestamp getCurrentDate();

When we try and go to the page, we get the following EL exception:

     javax.servlet.jsp.el.ELException: Attempt to coerce a value of type "java.util.Date" to type "java.sql.Timestamp"

Has anyone gotten around this?

----------------------------------------------
Neal Haggard
Senior Systems Developer
Knowledge Management Center
SAS Instititute


Re: Using java.sql.Timestamp with a Calendar component?

Posted by Mike Kienenberger <mk...@gmail.com>.
The patch recently described (and applied) in this MyFaces issue might
also be helpful.

http://issues.apache.org/jira/browse/MYFACES-389

On 8/15/05, Mike Kienenberger <mk...@gmail.com> wrote:
> You can specify your own converter for inputCalendar instead of using
> the HtmlCalendarRenderer.CalendarDateTimeConverter that it defaults
> to.
> 
> You could also change event to take a Date signature and convert a
> Date to a Timestamp in the getter and setter.
> 
> -Mike
> 
> On 8/15/05, Neal Haggard <Ne...@sas.com> wrote:
> > Any idea how to handle using a java.sql.Timestamp object in the inputCalendar component.  Here's our JSP code:
> >
> > <t:inputCalendar id="date" renderAsPopup="true"
> >                         renderPopupButtonAsImage="true" value="#{event.currentDate}" />
> >
> > Our event has the following:
> >
> >      public java.sql.Timestamp getCurrentDate();
> >
> > When we try and go to the page, we get the following EL exception:
> >
> >      javax.servlet.jsp.el.ELException: Attempt to coerce a value of type "java.util.Date" to type "java.sql.Timestamp"
> >
> > Has anyone gotten around this?
> >
> > ----------------------------------------------
> > Neal Haggard
> > Senior Systems Developer
> > Knowledge Management Center
> > SAS Instititute
> >
> >
>

Re: Using java.sql.Timestamp with a Calendar component?

Posted by Mike Kienenberger <mk...@gmail.com>.
You can specify your own converter for inputCalendar instead of using
the HtmlCalendarRenderer.CalendarDateTimeConverter that it defaults
to.

You could also change event to take a Date signature and convert a
Date to a Timestamp in the getter and setter.

-Mike

On 8/15/05, Neal Haggard <Ne...@sas.com> wrote:
> Any idea how to handle using a java.sql.Timestamp object in the inputCalendar component.  Here's our JSP code:
> 
> <t:inputCalendar id="date" renderAsPopup="true"
>                         renderPopupButtonAsImage="true" value="#{event.currentDate}" />
> 
> Our event has the following:
> 
>      public java.sql.Timestamp getCurrentDate();
> 
> When we try and go to the page, we get the following EL exception:
> 
>      javax.servlet.jsp.el.ELException: Attempt to coerce a value of type "java.util.Date" to type "java.sql.Timestamp"
> 
> Has anyone gotten around this?
> 
> ----------------------------------------------
> Neal Haggard
> Senior Systems Developer
> Knowledge Management Center
> SAS Instititute
> 
>