File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes JSF 2.0  format date according to the locale Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF 2.0  format date according to the locale" Watch "JSF 2.0  format date according to the locale" New topic
Author

JSF 2.0 format date according to the locale

Alex Indus
Greenhorn

Joined: Jun 01, 2012
Posts: 6
Hi Guys,
I'm creating my first JSF 2.0 application and I've faced with a strange problem: there are two links for selecting preferable language, when user click on one of this links the page is reloaded and page language is changed. Everything works fine except the date formatting - I need to click in the change language link once again to apply date formatting, it delayed by one step. E.g. I choose "En(US)" and all dates should be in mm/dd/yy format but they don't change(default format is dd.mm.yyyy) until I click any other link.
For setting locale I use code from this tutorial Localization article
Code from common layout page

Links for changing locale


Backing bean

Can anyone help me with this problem?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16308
    
  22

I seem to recall that the convertDateTime element javadocs explicitly say that it always works in GMT unless you code an alternative locale on the convertDateTime element itself. There is no provision for a global setting. So changing the View root locale wouldn't help.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF 2.0 format date according to the locale