Is it possible to change locale in doView method of the portlet ?
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, tools, and much more.