I wanted to try that so i created this TwoPhaseRenderingPortlet.java like this
package com.ibm.webspherenotes.jsr286;
import java.io.IOException;
import javax.portlet.GenericPortlet;
import javax.portlet.MimeResponse;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.w3c.dom.Element;
public class TwoPhaseRenderingPortlet extends GenericPortlet{
protected void doHeaders(RenderRequest request, RenderResponse response) {
System.out.println("Entering TwoPhaseRenderingPortlet.doHeaders()");
Element title = response.createElement("title");
title.setTextContent("www.webspherenotes.com portal page");
response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, title);
System.out.println("Exiting TwoPhaseRenderingPortlet.doHeaders()");
}
protected void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
System.out.println("Entering TwoPhaseRenderingPortlet.doView()");
response.setContentType("text/html");
response.getWriter().println("Hello from two phase rendering portlet");
System.out.println("Exiting TwoPhaseRenderingPortlet.doView()");
}
}
In the TwoPhaseRenderingPortlet, i am overriding doHeaders() method and inside the method, first i am creating a
title
element then i am setting the value of that element to www.webspherenotes.com portal page
and the last step is to call response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, title);
method which asks the RenderReponse object to insert newly created title element in the head
section of the document.Once the portlet is deployed i tried accessing it and i can see that the title that i set is displayed in the title bar of the browser, also when i tried looking at the source code i could see that the
<title>
element is added
Does the tow-phase rendering is supported in WP 6.1.5? I dont see such a comment in the infocenter, but it does not work for me. Can someone confirm this?
ReplyDeleteThat's great I've been looking for this king of functionality for a while.
ReplyDeleteNow quick the question:
Does the 286 implementation of WCM leverage such functionality in ordert to allow me to set that title too?
Didn't work for me :(
ReplyDeleteI'm using Websphere Portal 6.1.
it works fine in WP 8.0 :)
ReplyDeleteThanks for info
ReplyDeleteWeb Design Company in Bangalore
Website development in Bangalore