You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Sam Witty <sa...@yahoo.com> on 2008/10/03 02:44:21 UTC

convertDateTime caching (bug?)

It seems that f:convertDateTime is caching the various parameters such as
timezone, pattern etc... In other words they are loaded the first time the
page is created and never reloaded again even if they are specified as an EL
expression. 

For example:
<h:outputText value="#{backendBean.time}">
  <f:convertDateTime timeZone="#{backendBean.timeZone}" pattern="MM/dd/yy
HH:mm"/>
</h:outputText>

In the above the timeZone is read from the bean once (the first time the
page is constructed) and never again even though the value the EL expression
is pointing to does change. 

Is this a bug? Is there a workaround (short of writing your own converter in
your own tag library)?

Thanks
-Sam
-- 
View this message in context: http://www.nabble.com/convertDateTime-caching-%28bug-%29-tp19790378p19790378.html
Sent from the My Faces - Dev mailing list archive at Nabble.com.


Re: convertDateTime caching (bug?)

Posted by Matthias Wessendorf <ma...@apache.org>.
On Fri, Oct 3, 2008 at 10:27 PM, Sam Witty <sa...@yahoo.com> wrote:
>
> Matthias,
>
> Yup I saw that in the in the source code as well, which is why I though it
> was a bug (maybe still is a bug?) after all what is the point of allowing
> the use of an EL expression if you are only going to evaluate it once?

I think it is by design. In Trinidad we have a "setValueExpression()" on the
converters as well:

http://myfaces.apache.org/trinidad/trinidad-1_2/trinidad-api/apidocs/org/apache/myfaces/trinidad/convert/DateTimeConverter.html

Pretty much like all JSF components do:
http://java.sun.com/javaee/javaserverfaces/1.2_MR1/docs/api/javax/faces/component/UIComponent.html

But converters or validators don't

>
> I will look at Trinidad... And probably use it since I can not think of a
> work around... But man the amount of "libraries" are piling up, MyFace,
> Tomahawk, RichFaces and now Trinidad where does it end ;-)?

Trinidad is not only a JSF component set. It is a pretty solid
framework, that offers a lot's of goodies
It is IMO worth to check out the documentation. I have also some
samples on my blog.

-Matthias

>
> Thanks
> -Sam
>
>
> Matthias Wessendorf-4 wrote:
>>
>> In Trinidad, we pass the actual ValueBinding / ValueExpression to the
>> converter instance,
>> on getTimeZone(), for instance, we actually all
>> "valueBinding.getValue(context)", to get the
>> value.
>>
>> The standard does the resolving on the tag class:
>> http://svn.apache.org/repos/asf/myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java
>>
>> So, that's why you see the effect.
>> Worth to include Trinidad ;-)
>>
>> On Fri, Oct 3, 2008 at 2:44 AM, Sam Witty <sa...@yahoo.com> wrote:
>>>
>>> It seems that f:convertDateTime is caching the various parameters such as
>>> timezone, pattern etc... In other words they are loaded the first time
>>> the
>>> page is created and never reloaded again even if they are specified as an
>>> EL
>>> expression.
>>>
>>> For example:
>>> <h:outputText value="#{backendBean.time}">
>>>  <f:convertDateTime timeZone="#{backendBean.timeZone}" pattern="MM/dd/yy
>>> HH:mm"/>
>>> </h:outputText>
>>>
>>> In the above the timeZone is read from the bean once (the first time the
>>> page is constructed) and never again even though the value the EL
>>> expression
>>> is pointing to does change.
>>>
>>> Is this a bug? Is there a workaround (short of writing your own converter
>>> in
>>> your own tag library)?
>>>
>>> Thanks
>>> -Sam
>>> --
>>> View this message in context:
>>> http://www.nabble.com/convertDateTime-caching-%28bug-%29-tp19790378p19790378.html
>>> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>>
>>
>
> --
> View this message in context: http://www.nabble.com/convertDateTime-caching-%28bug-%29-tp19790378p19805002.html
> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

Re: convertDateTime caching (bug?)

Posted by Sam Witty <sa...@yahoo.com>.
Matthias,

Yup I saw that in the in the source code as well, which is why I though it
was a bug (maybe still is a bug?) after all what is the point of allowing
the use of an EL expression if you are only going to evaluate it once?

I will look at Trinidad... And probably use it since I can not think of a
work around... But man the amount of "libraries" are piling up, MyFace,
Tomahawk, RichFaces and now Trinidad where does it end ;-)?

Thanks
-Sam


Matthias Wessendorf-4 wrote:
> 
> In Trinidad, we pass the actual ValueBinding / ValueExpression to the
> converter instance,
> on getTimeZone(), for instance, we actually all
> "valueBinding.getValue(context)", to get the
> value.
> 
> The standard does the resolving on the tag class:
> http://svn.apache.org/repos/asf/myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java
> 
> So, that's why you see the effect.
> Worth to include Trinidad ;-)
> 
> On Fri, Oct 3, 2008 at 2:44 AM, Sam Witty <sa...@yahoo.com> wrote:
>>
>> It seems that f:convertDateTime is caching the various parameters such as
>> timezone, pattern etc... In other words they are loaded the first time
>> the
>> page is created and never reloaded again even if they are specified as an
>> EL
>> expression.
>>
>> For example:
>> <h:outputText value="#{backendBean.time}">
>>  <f:convertDateTime timeZone="#{backendBean.timeZone}" pattern="MM/dd/yy
>> HH:mm"/>
>> </h:outputText>
>>
>> In the above the timeZone is read from the bean once (the first time the
>> page is constructed) and never again even though the value the EL
>> expression
>> is pointing to does change.
>>
>> Is this a bug? Is there a workaround (short of writing your own converter
>> in
>> your own tag library)?
>>
>> Thanks
>> -Sam
>> --
>> View this message in context:
>> http://www.nabble.com/convertDateTime-caching-%28bug-%29-tp19790378p19790378.html
>> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Matthias Wessendorf
> 
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
> 
> 

-- 
View this message in context: http://www.nabble.com/convertDateTime-caching-%28bug-%29-tp19790378p19805002.html
Sent from the My Faces - Dev mailing list archive at Nabble.com.


Re: convertDateTime caching (bug?)

Posted by Matthias Wessendorf <ma...@apache.org>.
In Trinidad, we pass the actual ValueBinding / ValueExpression to the
converter instance,
on getTimeZone(), for instance, we actually all
"valueBinding.getValue(context)", to get the
value.

The standard does the resolving on the tag class:
http://svn.apache.org/repos/asf/myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java

So, that's why you see the effect.
Worth to include Trinidad ;-)

On Fri, Oct 3, 2008 at 2:44 AM, Sam Witty <sa...@yahoo.com> wrote:
>
> It seems that f:convertDateTime is caching the various parameters such as
> timezone, pattern etc... In other words they are loaded the first time the
> page is created and never reloaded again even if they are specified as an EL
> expression.
>
> For example:
> <h:outputText value="#{backendBean.time}">
>  <f:convertDateTime timeZone="#{backendBean.timeZone}" pattern="MM/dd/yy
> HH:mm"/>
> </h:outputText>
>
> In the above the timeZone is read from the bean once (the first time the
> page is constructed) and never again even though the value the EL expression
> is pointing to does change.
>
> Is this a bug? Is there a workaround (short of writing your own converter in
> your own tag library)?
>
> Thanks
> -Sam
> --
> View this message in context: http://www.nabble.com/convertDateTime-caching-%28bug-%29-tp19790378p19790378.html
> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf