Portlet communication across Portal pages using URL generation API


With JSR-286 API, you have an option to communicate from one portlet to another across portal pages using events mechanism. But in case of events you have to make sure that the wiring between portlets is properly configured.

What if you want to pass parameters from one portlet to another across page and without using wires?

Well this can be achieved using URL Generation API. Use the below code to pass parameters from source portlet.

String url = PortletURLHelper.generateUrl(PAGE_UNIQUE_NAME, Portlet Name, HashMap params, renderRequest, renderResponse);

You can get param values in target portlet using the below line of code.

Map map = renderRequest.getParameterMap();

Just iterate the map and find the values you passed from source portlet.

PAGE_UNIQUE_NAME would be page name on which you have target portlet and Portlet name would be your target portlet name. Params would be your parameters that you want to pass to target portlet.

No comments:

Post a Comment

Recent Posts

Popular Posts

© 2011-2019 Web Portal Club