Hi again :-).
After thinking about the GMT problem again i changed my mind.
The last weeks patch was the right way.
And i also found the reason for the different behavior of h:inputText
and h:outputText in my example.
I was wondering why the h:outputText doesn't use a converter, but i was
overlooking that the value of the h:outputText is not a Date object.
It's a String concatenated of two vb expressions.
jsf spec says evaluation of those expression is made according to jsp
2.0 spec. And jsp spec doesn't know anything about converters and makes
just toString(). The Dates toString() uses system timeZone, and so i got
this problem.
So i split the h:outputText :
<h:outputText
value="#{example_messages['date_comp_text6']} "/>
<h:outputText value="#{date3}">
<f:convertDateTime type="both"/>
</h:outputText>
and got the expected output.
Here i need to add the converter, because the default type is date only.
Regards
Volker Weber wrote:
> Hi,
>
> the javadoc says:
> public java.util.TimeZone getTimeZone()
>
> Return the TimeZone used to interpret a time value. If not
> explicitly set, the default time zone of GMT returned.
>
> so we can't change this.
>
> but i think (now) the patch we applied last week was the wrong solution.
>
> Instead of changing getAsString() to use getTimeZone() for setting the
> timeZone to the DateFormat, getAsObject() shouldn't do this.
>
> Of cause getAsString() and getAsObject() must use the same TimeZone,
> which was not the case last week.
>
> The following is taken and light modified from date.jsp in simple example:
>
> <h:inputText value="#{date3}">
> <f:convertDateTime type="both"/>
> </h:inputText>
> <f:verbatim><br></f:verbatim>
> <h:outputText value="#{example_messages['date_comp_text6']} #{date3}"/>
>
> The time differs in <h:inputText ../> and <h:outputText ../> cause of
> the GMT default in the converter. And around midnight also the date may
> differ.
>
> I'm shure this is not the expected behavior. But i'm not shure if this
> is not a problem in the h:outputText, shoudn't there also used the
> converter to convert the java.util.Date to string?
>
>
> But to be in sync with output generated by jsp the converter shoudn't
> use getTimeZone() but _timeZone.
>
>
> We should undo the patch from last week and change getAsObject()
> accordingly.
>
>
>
>
>
> ir. ing. Jan Dockx wrote:
>
>>I believe the default is the cause of all problems. I think the default
>>needs to be the systems time zone. But not sure yet.
>>
>>
>>On 29 Sep 2005, at 22:54, Mike Kienenberger wrote:
>>
>> This sounded vaguely familiar. I think it's been fixed.
>>
>> http://issues.apache.org/jira/browse/MYFACES-506?page=all
>> DateTimeConverter.getTimeZone should return the default time of the
>> GMT zone by default
>>
>>
--
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.