The portlet instance is the portlet on a page with the default personalizations made

Enhancing Java Portlets 7-51

7.2.8.2 Exporting Personalizations Example

This example illustrates the most basic case where you build a portlet and accept the default behavior for the export of personalizations. In the examples in Section 7.2.8.3.6, Encrypting Personalization Data Example and Section 7.2.8.3.7, Exporting by Reference Example , you will see how to enhance the security of your personalizations during export and import. To implement the more basic form of exporting personalizations, do the following:

1. Create a stock portlet and implement the Show mode with the following

MyStockPortletShowRenderer.java class. Note that this class does not incorporate any special code to enable exportimport. package oracle.portal.sample.v2.devguide.tx; import java.util.StringTokenizer; import oracle.portal.provider.v2.PortletException; import oracle.portal.provider.v2.personalize.NameValuePersonalizationObject; import oracle.portal.provider.v2.render.PortletRenderRequest; import oracle.portal.provider.v2.render.PortletRendererUtil; import oracle.portal.provider.v2.render.http.BaseManagedRenderer; import java.io.PrintWriter; import oracle.portal.sample.v2.devguide.webservices. NetXmethodsServicesStockquoteStockQuoteServiceStub; public class MyStockPortletShowRenderer extends BaseManagedRenderer { private String pid = null; private String userdata; private String stockList; private String stockCode; public void renderBodyPortletRenderRequest request throws PortletException { Use the PrintWriter from the PortletRenderRequest PrintWriter out = null; NetXmethodsServicesStockquoteStockQuoteServiceStub ns = new NetXmethodsServicesStockquoteStockQuoteServiceStub; try { out = request.getWriter; NameValuePersonalizationObject data = null; data = NameValuePersonalizationObjectPortletRendererUtil. getEditDefaultDatarequest; stockList= data.getStringstock; ifstockList=null { StringTokenizer st = new StringTokenizerstockList,,; out.printlntable border=0; out.printlnthead; out.printlntr; out.printlnth width=20; out.printlnp align=left Stock Codepthth width=20; out.printlnp align=left Quotep; out.printlnth; out.printlntr; out.printlnthead; whilest.hasMoreElements { stockCode= st.nextElement.toString; out.printlntr; out.printlntd width=20; out.printlnp align=left+ stockCode + ptdtd width=20; out.printlnns.getQuotestockCode; out.printlntd;