Breadcrumb Breadcrumb
Community Links Community Links
Javadoc Links Javadoc Links
Community Forums Community Forums
Combination View Flat View Tree View
Threads [ Previous | Next ]
Global h:messages for portal page
toggle
I have some portal pages with some JSF-based portlets on them?
I want to create a portlet for displaying global FacesMessages grabbed from those portlets - i.e. GlobalFacesMessagesHandlerPortlet.
So I would place my portlet on every page where JSF-portlets reside and would see in single place all global FacesMessages that my portlets add to FacesContext during request.

Is there a way to achieve this?
Flag Flag
RE: Global h:messages for portal page
2/13/10 5:37 PM as a reply to Artur Vilsov.
This is a challenging problem to solve, because each portlet has its own FacesContext ThreadLocal singleton, each one containing its own set of FacesMessages.

What JSF bridge are you using? If you're using the Sun OpenPortal JSF Portlet Bridge (jsf-portlet.jar) then you might be able to extend the FacesPortlet, and override the processAction() method. Before the FacesContext.release() method is called, you could save-off the FacesMessages contained in the FacesContext and add them to an attribute in the PortletSession.APPLICATION_SCOPE. That way, when it comes time for the portlet at the top of the page to render itself, it could examine the attribute in PortletSession.APPLICATION_SCOPE and display the list of messages.
Flag Flag