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

4 comments:

  1. Could you pls tell me why you use Async desktop? what is the use of having one?

    ReplyDelete
  2. To refresh the content of the portlet with out reloading the whole page I chose Async desktop option.

    ReplyDelete
  3. To refresh the content of the portlet with out reloading the whole page I chose Async desktop option.

    ReplyDelete
  4. I put Thread.sleep(2000) in the left portlet and Thread.sleep(4000) in right portlet with Portal rendering in Desktop Async mode - to simulate realistic conditions. I've placed an unrelated third portlet too on the page.

    I find that the entire page reloads. Can you please verify?

    ReplyDelete