Announcement Announcement Module
Collapse
No announcement yet.
Locale Incorrectly Set in Request Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Locale Incorrectly Set in Request

    Hi,

    I noticed that trying to fetch the locale in a tag lib using the following doesn't seem to work correctly:

    Code:
    Locale locale = pageContext.getRequest().getLocale();
    Any ideas why this doesn't work?

    Thanks

    jv

  • #2
    The request.getLocale() method returns the locale from the Accept-Header the client sent along with the request and does not always correspond with the locale set by the LocaleResolver. If you set the AcceptHeaderLocaleResolver it will be the same, if you use another LocaleResolver it can be different because for example a CookieLocaleResolver uses a cookie to retrieve the local from, not the AcceptHeader.

    Hope this helps.

    rgds,
    Alef Arendsen

    Comment


    • #3
      but in my case, both fmt:message and spring:message return always same locale as request - please see
      http://forum.springframework.org/showthread.php?t=17883
      Last edited by robyn; May 14th, 2006, 09:12 PM.

      Comment

      Working...
      X