Tuesday, October 27, 2009

IPC between two JSR 168 portlets with out reloading the page(asynchronoes)

My requirement is IPC between two JSR 168 portlets with out reloading the page(Lleft and right portlets)


I made asynchronoes desktop and I used the custom events

I fired the left portlet event from the right portlet in the below way it worked perfectly.

Event in left portlet :
---------------------

public void getMessage(ActionRequest request, ActionResponse response,

Event event) {

CustomEvent customEvent = (CustomEvent) event;

String message = (String) customEvent.getPayload();

response.setRenderParameter("message0", message);

}

Add/Create event handelar "messageCustomEvent" from from properties file in left portlet

I called the left portlet event from the right portlet processAction method in the below way

javax.servlet.http.HttpServletRequest httpRequest = (javax.servlet.http.HttpServletRequest)request.getAttribute("javax.servlet.request");

com.bea.netuix.servlets.controls.portlet.backing.PortletBackingContext context = com.bea.netuix.servlets.controls.portlet.backing.PortletBackingContext.getPortletBackingContext(httpRequest);

context.fireCustomEvent("messageCustomEvent", navvar);


It worked perfectly with out refereshing the screen


Thamks,
Venkata Sarvabatla

Thursday, October 15, 2009

Show/Hide portlet in Runtime

Question :
I have been trying to hide a portlet at runtime using portletBackingContext.setVisible(false) in preRender() method of the backing file.
 But still that portlet is visible. how to hide the portlet in runtime.

 
Answer :

setVisible(false) and return false from the prerender method.