Adobe COLDFUSION 9 Manual page 913

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion Portlets
<cfparam name="request.portlet.parameters.page" default="">
<cfif request.portlet.parameters.page IS "somepage">
<cfinclude template="somepage.cfm">
<cfelse>
<!--- put step 1 here --->
</cfif>
Processing actions using form posts
To process a form post, use the
For example:
<cfoutput>
<form action="#createActionURL()#" method="post">
Value:
<input type="text" name="action_value" >
<input type="submit" value="Process Action" />
</form>
</cfoutput>
When the form is submitted, the portal container calls the
method as follows:
<cffunction name="processAction" returntype="void" access="public" output="false"
hint="Called by the portlet container to allow the portlet to process an action request.">
<cfargument name="actionRequest" type="any" required="true" hint="A
javax.portlet.ActionRequest java object">
<cfargument name="actionResponse" type="any" required="true" hint="A
javax.portlet.ActionResponse java object">
<cfif IsDefined("request.portlet.parameters.action_value")>
<!--- do something with this value, such as update your database --->
</cfif>
</cffunction>
Examples
The following examples show how you can configure portlets. You can add the following code to the
method depending on whether you are configuring the portlet on a local or remote server.
• To get portal user information:
JSR:
<cfoutput>#renderRequest.getRemoteUser()#</cfoutput>
WSRP:
<cfdump var = #renderRequest.getAttribute("javax.portlet.userinfo")#>
• To display PDF:
<cfdocument format="pdf" src="http://www.google.com" filename="cfdoc1.pd f "
overwrite="true">
</cfdocument>
<cfset pdfURL = getPortletResponse().encodeURL(getPortletRequest().getContextPath() &
"/<path of pdf>/cfdoc1.pdf")>
<cfoutput>
<object data="#pdfURL#" type="application/pdf" width="600" height="400">
</object>
</cfoutput>
function, which generates the form action URL.
createActionURL()
processAction()
Last updated 8/5/2010
method in your CFC. So, add this
doView()
908

Advertisement

Table of Contents
loading

Table of Contents