aspose file tools*
The moose likes JSF and the fly likes Problem with localization (MyFaces and JSTL) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem with localization (MyFaces and JSTL)" Watch "Problem with localization (MyFaces and JSTL)" New topic
Author

Problem with localization (MyFaces and JSTL)

Piotr Cierny
Greenhorn

Joined: Jul 21, 2008
Posts: 6
I have created a simple application that uses 2 languages - english and polish. I want to set locale with html link for myfaces and jstl tags.
The problem is that when i press the link, it only changes the messages outputed by jsf tags. The jstl messages remain unchanged.
The locale is changing (checked with cut) but messages aren`t.
The funniest thing happends when i change language to english and check the chceckbox - All messages change to english and the jstl locale variable is emptied (cut doesn`t write anything out).

This example worked with jsf1.1.5 but it doesn`t work with jsf 1.2.
Can any one tell me why??

I enclose the code of this example:
welcome.jsp


User.java


faces-config.xml


I`ve tried to download new jstl.jar and standard.jar, add tlds and declarations in web.xml but it didn`t help.

If anyone knows answer to this mystery please help.
Piotr Cierny
Greenhorn

Joined: Jul 21, 2008
Posts: 6
This is my first post. Sorry for bad code. here is a good one.

welcome.jsp


User.java


faces-config.xml
Ryan Lubke
Ranch Hand

Joined: Jun 20, 2007
Posts: 36
This was cross-posted in the sun forums. I've already answered there.

Originally posted by Piotr Cierny:
I have created a simple application that uses 2 languages - english and polish. I want to set locale with html link for myfaces and jstl tags.
The problem is that when i press the link, it only changes the messages outputed by jsf tags. The jstl messages remain unchanged.
The locale is changing (checked with cut) but messages aren`t.
The funniest thing happends when i change language to english and check the chceckbox - All messages change to english and the jstl locale variable is emptied (cut doesn`t write anything out).

This example worked with jsf1.1.5 but it doesn`t work with jsf 1.2.
Can any one tell me why??

I enclose the code of this example:
welcome.jsp


User.java


faces-config.xml


I`ve tried to download new jstl.jar and standard.jar, add tlds and declarations in web.xml but it didn`t help.

If anyone knows answer to this mystery please help.
Piotr Cierny
Greenhorn

Joined: Jul 21, 2008
Posts: 6
I fixed the problem by adding locale="#{facesContext.viewRoot.locale}" to f:view tag.

But could anyone explain me why this does`t work without specifying the locale in the view tag?

Shouldn`t the fmt:setLocale tag set locale for jstl tags only using parameter given in URL
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with localization (MyFaces and JSTL)