Search in the Documentation:

How to share a bean?

To share a bean, you have to:

  1. Create a jar that contains the class of the bean.

  2. Put the jar in the shared lib of your application server.

  3. Share the bean as any simple object.

/**
* SimpleEvent class is in a shared lib.
*
* Example of processAction(…) of any portlet
*/
public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException {
Map map = (Map) actionRequest.getAttribute("jahiaSharedMap");
map.put("simpleEvent",
new SimpleEvent(new Date(), "simple event test"));
actionRequest.setAttribute("jahiaSharedMap", map);
}
/**
* SimpleEvent class is in a shared lib.
*
* Example of render(…) of any other portlet
*/
public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException {
Map map = (Map) renderRequest.getAttribute("jahiaSharedMap");
SimpleEvent event = ((SimpleEvent)map.get("simpleEvent"));
}