Forums de discussion
SessionErrors in jsf Portlets
Stephan Poschetzky, modifié il y a 10 années.
SessionErrors in jsf Portlets
New Member Publications: 3 Date d'inscription: 10/12/12 Publications récentes
Hi there,
I have a little problem with the Liferay messages. I tried to add a error message with the following code from my ManagedBean:
The message appears as expected. But how can I set the language key for my SessionError? I also noticed that I can use
My configuration:
JBoss AS 7.11
Liferay CE 6.1.1-ce-ga2
Primefaces 3.5
Facesbridge 3.1.1-ga2
I have a little problem with the Liferay messages. I tried to add a error message with the following code from my ManagedBean:
FacesContext facesContext = FacesContext.getCurrentInstance();
PortletSession portletSession = (PortletSession) facesContext
.getExternalContext().getSession(true);
SessionErrors.add(portletSession, "number-format-exception");
The message appears as expected. But how can I set the language key for my SessionError? I also noticed that I can use
<liferay-ui:info message="..." />
But <liferay-ui:error message="..." />
doesn't work :/ My configuration:
JBoss AS 7.11
Liferay CE 6.1.1-ce-ga2
Primefaces 3.5
Facesbridge 3.1.1-ga2
Neil Griffin, modifié il y a 10 années.
RE: SessionErrors in jsf Portlets
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
You need to do it the JSF way, which would be like this:
In your XHTML view:
And in your Java code:
Note that you would need to include the liferay-faces-portal.jar dependency in your project.
In your XHTML view:
<h:messages globalOnly="true" />
And in your Java code:
LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
liferayFacesContext.addGlobalErrorMessage("number-format-exception");
Note that you would need to include the liferay-faces-portal.jar dependency in your project.
Stephan Poschetzky, modifié il y a 10 années.
RE: SessionErrors in jsf Portlets
New Member Publications: 3 Date d'inscription: 10/12/12 Publications récentes
Thank you Neil with this way it works.
Neil Griffin, modifié il y a 10 années.
RE: SessionErrors in jsf Portlets
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
My pleasure Stephan. Thanks for using Liferay Faces.