myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Spencer <pau...@apache.org>
Subject Re: ClassCastException when setting timeZone attribute in <f:convertDataTime> using EL
Date Wed, 31 May 2006 17:46:53 GMT
Matthias,
When I changed my method getTimeZone() to return a TimeZone, things worked as expected.

I guess my confusion comes from the TLD Documentation, http://myfaces.apache.org/impl/tlddoc/index.html.

   "When this value is a value-binding to a TimeZone instance, that timezone is used. Otherwise
    this value is treated as a String containing a timezone id, ie as the ID parameter of
method
    java.util.TimeZone.getTimeZone(String)."

I read this to mean that the converter would converter would treat String value-binding the
same way
as a String value.  Below is a coded version of my expectation.

   if (UIComponentTag.isValueReference(value))
   {
     ValueBinding vb = facesContext.getApplication().createValueBinding(value);
     TimeZone timeZone;
     Object value = vb.getValue(facesContext);
     if (value instanceof TimeZone)
     {
       timeZone = (TimeZone) value;
     }
     else
     {
       timeZone = TimeZone.getTimeZone(value.toString())
     }
     converter.setTimeZone(timeZone);
   }

Is my expectation in keeping with the spec?
If it is case should I enter a JIRA issue?

Paul Spencer

Paul Spencer 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
>>
> 
> 
> 


Mime
View raw message