How to change the page title from within a Coldfusion 9 Portlet
So in an earlier post I described the process to get started with a very basic portlet running under JBOSS / Coldfusion 9 / Liferay 6. This post assumes that you actually are developing portlets, and have already setup the underlying structure to host said portlets.
This is a simple piece of code that allows you to set the Liferay page title of wherever your CF9 portlet is housed.
I turned it into a quick function that I could call (or house inside of a cfcomponent for re-use)
<cffunction name="core_setPageTitle" access="public" hint="Use this function to set the HTML Page Title" output="false" returntype="void"> <cfargument name="title" default="" required="true" hint="Need the text for page title" /> <!--- INCLUDE JAVA OBJECT TO SET PAGE TITLE ---> <cfset portalUtil = CreateObject("java", "com.liferay.portal.util.PortalUtil")> <cfset httpServletRequest = portalUtil.getHttpServletRequest(getPortletRequest())> <cfset portalUtil.setPageTitle(arguments.title, httpServletRequest)> </cffunction>