Hi at all,
I have this view and this methods in controller , all is fine in servlet
mode but in portlet mode:
- the locale is not immedialty rendered (next page is ok)
- the "reset" change also the locale (in "en" where i am in "fr")
without sense for me.
-----------------------------------------------------------------------
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr"%>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh"%>
<f:view locale="#{commonController.locale}">
<f:loadBundle basename="MessageResources" var="msg" />
<tr:document title="#{msg['DIRECTORY.TEXT']}">
<f:facet name="metaContainer">
<link rel="apple-touch-icon" href="images/touchicon.png">
<meta name="viewport" content="initial-scale=1.0,
maximum-scale=1.0, user-scalable=0" />
<link href="./minimal/minimal.css" rel="stylesheet"
type="text/css" />
</f:facet>
<tr:form id="home">
<tr:panelHeader id="panelHeader" styleClass="toolbar"
text="#{msg['DIRECTORY.TEXT']}">
<tr:commandLink id="reset" styleClass="resetButton"
text="#{msg['CANCEL.TEXT']}"
actionListener="#{commonController.reset}" />
<tr:commandLink styleClass="loginButton" action="login"
rendered="#{not commonController.userAuthenticated
and not commonController.portletMode}"
immediate="true" />
<tr:commandLink styleClass="logoutButton"
actionListener="#{commonController.logout}"
rendered="#{commonController.userAuthenticated and
not commonController.portletMode}"
immediate="true" />
<tr:commandLink id="fr" styleClass="frButton"
actionListener="#{commonController.setLocaleFrench}"
immediate="true" />
<tr:commandLink id="en" styleClass="enButton"
actionListener="#{commonController.setLocaleEnglish}" immediate="true" />
</tr:panelHeader>
<tr:outputText styleClass="user" value="#{msg['USER.TEXT']}
#{commonController.user}"
rendered="#{commonController.userAuthenticated and not
commonController.portletMode}" />
<tr:panelList styleClass="panelList">
<tr:inputText id="name" value="#{commonController.name}"
required="true" label="">
<f:validator validatorId="nameValidator" />
</tr:inputText>
<tr:commandLink text="#{msg['STAFF.TEXT']}"
action="persons" />
<tr:commandLink text="#{msg['STUDENTS.TEXT']}"
action="students"
rendered="#{commonController.userAuthenticated}" />
<tr:commandLink text="#{msg['ENTITIES.TEXT']}"
action="entities" />
<tr:goLink text="#{msg['FACULTY_WEB_PAGE.TEXT']}"
destination="#{commonController.facultyWebPageUrl}" />
</tr:panelList>
</tr:form>
</tr:document>
</f:view>
---------------------------------
/**
* @param actionEvent
* @return navigation String.
*/
public String setLocaleFrench(ActionEvent actionEvent) {
FacesContext context = FacesContext.getCurrentInstance();
context.getViewRoot().setLocale(new Locale("fr"));
locale = "fr";
logger.info("Language: fr");
return "home";
}
/**
* @param actionEvent
* @return navigation String.
*/
public String setLocaleEnglish(ActionEvent actionEvent) {
FacesContext context = FacesContext.getCurrentInstance();
context.getViewRoot().setLocale(new Locale("en"));
locale = "en";
logger.info("Language: en");
return "home";
}
/**
* @return the locale
*/
public String getLocale() {
return locale;
}
/**
* @param actionEvent
* @return navigation String.
*/
public String reset(ActionEvent actionEvent) {
name = null;
logger.info("Action: reset");
return "home";
}
--
Yves Deschamps
CRI Pôle Web, Environnement Numérique de Travail
Bâtiment M4
Tel : 03 20 43 41 89
Fax : 03 20 43 66 25