I have a portal built on JBoss Portal 2.5.4 that needs to have some I18N. On the login.jsp page (which is in portal-server.war), we added a language switch. One of the links on the page is to the Forget Password facility.
For reasons related to look-and-feel, the ForgetPassword page is implemented as a maximized portlet inside our JBoss Portal. But, obviously, there's no user object yet, since there hasn't been a login.
So how do I pass the locale information that the user selects on the login.jsp down into the Forget Password jsp?
I've tried:
This is all running on Windows Vista or 2003.
Is there some obvious technique I'm missing? Do I just need to bite the bullet and reorganize my ForgetPassword page as a servlet so I can get URL parameters?
Ok, I found one mechanism to do this - create a new portlet window (ForgotPasswordWindow_de) in portal-object.xml:
<window>
<window-name>ForgotPasswordWindow_de</window-name>
<instance-ref>UserMgmtPortletInstance_de</instance-ref>
<region>center</region>
<height>0</height>
</window>
which points to a new portlet instance (UserMgmtPortletInstance_de) in portlet-instances.xml, which pointed to the same Portlet, with a lang preference defined.
<deployments>
<deployment>
<instance>
<instance-id>UserMgmtPortletInstance</instance-id>
<portlet-ref>UserMgmtPortlet</portlet-ref>
<preferences>
<preference>
<name>lang</name>
<value>en</value>
<read-only>true</read-only>
</preference>
</preferences>
<security-constraint>
<policy-permission>
<unchecked/>
<action-name>view</action-name>
</policy-permission>
</security-constraint>
</instance>
</deployment>
<!-- add new deployment for UserMgmtPortletInstance_de -->
<deployment>
<instance>
<instance-id>UserMgmtPortletInstance_de</instance-id>
<portlet-ref>UserMgmtPortlet</portlet-ref>
<preferences>
<preference>
<name>lang</name>
<value>de</value>
<read-only>true</read-only>
</preference>
</preferences>
<security-constraint>
<policy-permission>
<unchecked/>
<action-name>view</action-name>
</policy-permission>
</security-constraint>
</instance>
</deployment>
</deployments>
Then, in the Portlet doView() code, I find this preference, and set an attribute.
String lang = request.getPreferences().getValue("lang", null);
request.setAttribute("lang", lang);
Then, in the jsp, I look at the attribute, and set the locale.
String locale = (String) request.getAttribute("lang");
And to kick it all off, the login page has a switch, and if the language is german, it calls ForgotPasswordWindow_de instead of ForgotPasswordWindow_en