Is it possible to change locale in doView method of the portlet ?

Solution Unverified - Updated -

Issue

  • How can I change the locale of the application in doView method and retain it for session.
    I am trying to change locale of my application by following code:
LocaleConfig localeConfig = localeConfigService.getLocaleConfig(language.toLowerCase());
            if (localeConfig == null)
            localeConfig = localeConfigService.getDefaultLocaleConfig();
            PortalRequestContext prqCtx = PortalRequestContext.getCurrentInstance();
            prqCtx.setLocale(localeConfig.getLocale());

Locale of that page is changed successfully but it is not retained on the next page. This happens when I try to change the locale in doView method of my portlet.
This same code retains the locale of the application and work correctly if I write it in processAction method.

Environment

  • Red Hat JBoss Portal (JPP)
    • 6.1.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.