This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Locale issue...

Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic