File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Locale issue... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Locale issue..." Watch "Locale issue..." New topic

Locale issue...

Daniel Platon
Ranch Hand

Joined: Oct 10, 2005
Posts: 42
Hello everyone,

Strictly speaking (writing) this is not a Struts question, although I'm using Struts. It is more a "does anyone has any ideea" kind of question.
Here it goes: when the user logs in he chooses the applications locale (language, date format etc). He has to choose between Romanian (native language) and English. The locale object is available via the request object throughout the web application. The language is not an issue, struts takes care of that. The problem is the date format. In my jsp page I display the date using <bean:write name="<my_req_attribute" property="<my_date_property>"/> and I want to format it according to the locale - one way for English (day-of-week, month day, year) the other way for Romanian (day-of-week, day month year). Technically I can do this by using a method in my bean that formats the date using SimpleDateFormat and the given format according to the locale. The problem is I don't have access to the request object from my bean (nor should I have to) to get the locale. Does any one know how I can solve this issue ?!

Thanks a lot !
I agree. Here's the link:
subject: Locale issue...
It's not a secret anymore!