Thursday, September 18, 2008

Simple steps to create a portlet and consume it in Oracle Webcenter

There is definitely tons of documentation on this topic - I am not going to repeat it all but I thought a super, simple distilled version always helps ;)

  1. In JDeveloper, create a new web application with "portlet, repository, JSF" capabilities. This creates three projects in your application - "Model" (for your data needs), "Portlets" (where your portlets will reside) and "View Controller" (to build your JSF pages and components).
  2. Right-click your Portlets project, pick "New" -> Web Tier -> Standards-based Java portlet (JSR-168) to lauch the wizard. The rest of the wizard steps are pretty self-explanatory and the requisite files are automatically generated for you.
  3. Right-click on your Portlets project to create a new deployment descriptor (New... -> Deployment Descriptor).
  4. Right-click on your brand new *.deploy file created in the "Resources" folder and deploy. Your portlet is now deployed to your app server. Note: Remember to go to the connections tab and create an application server connection that you can deploy your portlet to prior to the deployment.
  5. In your browser window, type http://<host>:<port>/<context-root>/info to see your portlet's deployment status and to get the links to the portlet's WSDL (wsrp 1 and 2 are automatically generated).
  6. From your View Controller project, right-click to register a new WSRP Producer (New.. -> Web Tier -> WSRP Producer Registration). The URL endpoint to use here is the url of the WSDL from step 5 - either WSRP1 or WSRP2, based on the standard you are using. You will now see the newly registered portlet producer in the Portlet Producer folder in your application. 
  7. Create a new JSF *.jspx page using New...->Web-Tier->JSF page wizard.
  8. If you haven't already, right-click on the View Controller project and in the project properties, add the Customizable Core Components library to the project to have this show up in your component palette.
  9. Drag and drop the "PanelCustomizable" component within the h:form already on the page. Find the portlet producer you just registered in the component palette, pick your portlet in it and drop it within the PanelCustomizable on the JSF page. Note: If you don't find the portlet producer in the palette, make sure you created it from within the project. 
  10. Run the JSF page by right-clicking on it selecting "Run". You can see your portlet being consumed by the JSF page :)

No comments: