This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes SOLVED: how to set locale in Filter struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "SOLVED: how to set locale in Filter struts 2" Watch "SOLVED: how to set locale in Filter struts 2" New topic
Author

SOLVED: how to set locale in Filter struts 2

Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
Hi!

I want to set Locale in a filter but it's now woking using struts 2.
I can not go thru the class org.apache.struts because I don't have it. Must use struts 2.
[ May 23, 2007: Message edited by: Mathias Nilsson ]

SCJP1.4
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
I managed to solve this myself!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It's great that you solved the problem, but for the benefit of others who might be seeking an answer to the same problem, could you please post your solution?

Thanks


Merrill
Consultant, Sima Solutions
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
Sorry... working around the clock



I'm doing this in a filter. You can use ActionContext.getContext() to set the locale at least if you are using struts 2. When choosing the resource use LocalizedTextUtil to add the resource.

I couldn't get it to work without setting the default locale.

// Mathias
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: SOLVED: how to set locale in Filter struts 2
 
Similar Threads
How to use, struts 1-- struts-config.xml and struts 2 -- struts.xml together?
How to set Locale on IE
Internationlization problem
query regarding locale in struts
struts.properties struts.locale properties