myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject Re: ClassCastException when setting timeZone attribute in <f:convertDataTime> using EL
Date Wed, 31 May 2006 17:41:25 GMT
Can you *convert* it to TimeZone?

By wrapping w/ TimeZone.getTimeZone("GMT-05:00");  ?


Inside if setConverterTimeZone the CCE happens.
When you are using *hard coded* Strings, the else {} is executed.
By using EL / ValueBinding (timeZone="#{phrQueryManager.timeZone}") the if {}
is executed.

HTH,
Matthias

<snip>
private static void setConverterTimeZone(FacesContext facesContext,
                                             DateTimeConverter converter,
                                             String value)
    {
        if (value == null) return;
        if (UIComponentTag.isValueReference(value))
        {
            ValueBinding vb =
facesContext.getApplication().createValueBinding(value);
            converter.setTimeZone((TimeZone)vb.getValue(facesContext));
        }
        else
        {
            converter.setTimeZone(TimeZone.getTimeZone(value));
        }
    }
</snip>

On 5/31/06, Paul Spencer <paulsp@apache.org> wrote:
> The type is string
>    public String getTimeZone()
>    {
>      return "GMT-05:00";
>    }
>
> Paul Spencer
>
> Matthias Wessendorf wrote:
> >>    <f:convertDateTime type="time"
> >> timeZone="#{phrQueryManager.timeZone}"/>
> >
> > Is this type of TimeZone ?
> >
> > *snip*
> >       if (UIComponentTag.isValueReference(value))
> >        {
> >            ValueBinding vb =
> > facesContext.getApplication().createValueBinding(value);
> >            converter.setTimeZone((TimeZone)vb.getValue(facesContext));
> >        }
> > *snip*
> >
> > Regards,
> > Matthias
> >
>
>
>


-- 
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Mime
View raw message