[jboss-user] [JBoss Seam] - Re: [newbie] timezones and s:convertDateTime

mars1412 do-not-reply at jboss.com
Wed Dec 12 09:11:57 EST 2007

after some other hours of trying, changing and debugging, I already know somthing more :-)

when I change the timezone via the timezone-switcher, the timezone will be set to the new value, BUT at that time the date-time that I display on the page has already been converted (using the "old" timezone) and thus will not reflect the timezone change. when I refresh the page manually again, it is ok (which is of course an unreasonable demand to our webusers..).
anyway, here is what I think, why this happens:

when I press the button in my page, a POST request will be sent to the server (the action to execute is of course timezone.select).
In the phases of the JSF lifecycle, the following will happen:
*  Apply Request Values Phase
  |    timeZoneSelector.select event is queued (not executed)
  | *  Process Validations Phase
  |   s:convertDateTime will call its converter: DateTimeConverter, which will convert the date/time using the current time zone, which is of course still the "old" timezone
  | *  Update Model Phase
  |    the converted date/time from the last step is pushed to the model
  |    the new TimeZone is pushed into model
  | *  Invoke Application Phase
  |    the queued event is now executed:
  |    - from now on the new time zone is active
  |    - TimeZoneSelector raises "org.jboss.seam.timeZoneSelected" event
  | *  Render Response Phase
  |     the page is rendered and the value of my date/time field is still that one calculated in the Process Validations Phase (with the old timezone)
when I now refresh the page manually, the new timezone is already active and now the DateTimeConverter uses this new timezone and the calculated value will be displayed as expected.

since I'm a newbie with all that JSF, SEAM, etc. stuff, I appreciate any coments on this..

following questions that are still open:
*  any ideas for a solution/workaround? how can I avoid that manually refreshing of the page
  | *  who observes the "org.jboss.seam.timeZoneSelected" event?? I searched through all seam .java files, but couldn't find any observer?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112264#4112264

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4112264

More information about the jboss-user mailing list