• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Internationalisation: Struts only detects browser's language settings after login

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am building a site in englisg, dutch and german and have found that with no effort on my part the site reponds in the correct language depending on the languge settings in the web browser, but only once I have logged into the site and thus established a session. the login page itself defaults to english. How does struts pick up the language from the browser and why does it only do this after user-login and not all the time?
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In general, you can obtain the Locale from the request by calling ServletRequest.getLocale().
Your welcome page will only be displayed in the correct language if your welcome page is accessed through a Struts Action. If it is accessed directly by entering a url like */*.jsp Struts is bypassed.
Therefore no lookup of the proper MessageResource will be done.
Cheers,
Ruud.
[ May 30, 2003: Message edited by: Ruud Steeghs ]
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To get over this type of problem, I used a JSP page with a <jsp:forward> in it, as the home page of my site. This forwarded to the Maverick command (for Struts, read "Action", I think) of the "real" home page.
I am a little worried that this is bad for search engines, however. Does anyone know if that's true?
 
dave sag
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that's what i do actually, and i just discovered by adding locale="true" to the html:html tag it works perfectly.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic