Building a WCM

Page 347

4.3.1 Lotus Web Content Management API Sample WCM API Samples used for the RiverBend site In the following article, we discuss the first of two specific samples.

Sample 1 - Add Comments to News This sample provides an easy method to add comments and ratings to News items in riverbend site. There are many number of ways this can be implemented and this is one of the ways to implement comments. To accomplish this, add a new text element into News Authoring Template as below

Add the below code into comments.jsp and store it into <wp_profile>\installedApps\<nodename>\ PA_WCMLocalRendering.ear\ilwwcmlocalrende.war\jsp\html. Create a JSP Component named “ commentsJSP ” pointing to “ jsp/html/comments.jsp ” <%@ page import="com.ibm.workplace.wcm.api.*"%> <%@ page import="com.ibm.wps.services.ServiceManager"%> <%@ page import="java.util.*,java.security.Principal"%> <%@ page import="java.text.SimpleDateFormat"%> <%//Use WebSphere Portal Service Manager to obtain the WCM Service try { // Construct and inital Context javax.naming.InitialContext ctx = new javax.naming.InitialContext(); // Retrieve WebContentService using JNDI name WebContentService webContentService = (WebContentService) ctx.lookup("portal:service/wcm/WebContentService"); //Get the WCM Repository Repository rep = webContentService.getRepository(); //Get an authenticated WCM Workspace Workspace wsa = rep.getWorkspace();

- 347 –


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.