To write into the HTML head section of
your JSR 286 portlet, for example, to change a page title, use the addProperty
method on the PortletResponse.
Invoke the addProperty method to modify the HTML head section.
PortletReponse.addProperty(String key, org.w3c.dom.Element element)
Invoke the addProperty method to modify the HTML head section.
PortletReponse.addProperty(String key, org.w3c.dom.Element element)
Note: When modifying the HTML head section, you must invoke the addProperty method before the response headers are committed. This should occur no later than during the render headers sub phase of the render lifecycle phase.
Below is the example
to explain this.
protected void
doHeaders(RenderRequest request, RenderResponse response)
{
Element title =
response.createElement("title");
title.setTextContent("My Portal Page
Title");
response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, title);
}
No comments:
Post a Comment