|
IBM WebSphere Application ServerTM Release 7 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
Localized | Interface providing methods to obtain title and description of a portal resource. |
ObjectID |
The WAS 6.1 provides a subset of the Portal DynamicUI functionality. It allows context to be passed to either a entire page (all portlets get the context on a page) or to a specific portlet on the same page. Currently only String values are supported which are passed as parameters. Titles and descriptions cannot be altered and portlets must already exist on the page and are not dynamically launched.
In order for the portlet to receive the context, it must enable the context by setting a read-only preference in your portlet.xml: com.ibm.portal.pagecontext.enable.
The follow code segment normally done during init() call, shows how to get the Dynamic UI services:
try { Context ctx = new InitialContext(); propertyFactoryServiceHome = (PortletServiceHome)ctx.lookup("iscportletservice/com.ibm.portal.propertybroker.service.PropertyBrokerService"); if (propertyFactoryServiceHome == null) System.out.println("no PropertyBrokerService Home"); else propertyFactoryService = (PropertyFactory)propertyFactoryServiceHome.getPortletService(com.ibm.portal.propertybroker.service.PropertyBrokerService.class); dynamicUIManagerFactoryServiceHome = (PortletServiceHome)ctx.lookup("iscportletservice/com.ibm.portal.portlet.service.DynamicUIManagerFactoryService"); if (dynamicUIManagerFactoryServiceHome == null) System.out.println("no dynamicUIManagerFactoryService Home"); else dynamicUIManagerFactoryService = (DynamicUIManagerFactoryService) dynamicUIManagerFactoryServiceHome.getPortletService(com.ibm.portal.portlet.service.DynamicUIManagerFactoryService.class); } catch (NamingException e) { System.out.println("*******NE failure: " + e); } catch (PortletServiceUnavailableException e) { System.out.println("********PSU failure: " + e); }
This code segment shows how to create context and pass it to a portlet on the same page:
Context ctx = null; ObjectID portletDefinitionID = null; // Portlet Application ID / Portlet Name (See portlet.xml) String portletname="com.ibm.isclite.sample.portletdyncontext.1234/PortletGet"; try { ctx = new InitialContext(); portletDefinitionID =(ObjectID)ctx.lookup("portal:config/portletdefinition/"+portletname); } catch (NamingException ne) { ...error processing... } try { PropertyController cproperty1 = propertyFactoryService.createProperty(myconfig); cproperty1.setNamespace("namespace"); cproperty1.setType("String"); cproperty1.setName("one"); PropertyController cproperty2 = propertyFactoryService.createProperty(myconfig); cproperty2.setNamespace("namespace"); cproperty2.setType("String"); cproperty2.setName("two"); PropertyValue[] propertyValues = new PropertyValue[2]; propertyValues[0] = propertyFactoryService.createPropertyValue(request, cproperty1, "Uno"); propertyValues[1] = propertyFactoryService.createPropertyValue(request, cproperty2, "Dos"); DynamicUICtrl dmanagerCtrl = dynamicUIManagerFactoryService.getDynamicUICtrl(request, response, "isc.tasklaunch"); ObjectID newPortletID = dmanagerCtrl.addSharedPortlet(portletDefinitionID, null, propertyValues); } catch(DynamicUIManagementException e) {System.out.println("DynamicUIMgmtException:"+e.getMessage());} catch(CreateFailedException e) {System.out.println("CreateFailedException:"+e.getMessage());} catch(AccessFailedException e) {System.out.println("AccessFailedException:"+e.getMessage());}
The receiving portlet will get the context passed in as parameters:
String value1 = request.getParameter("one"); String value2 = request.getParameter("two");
|
IBM WebSphere Application ServerTM Release 7 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |