Adobe Flex for portlet Ui

There is lot of interest in using Adobe Flex for building Rich application interface for Portlet application, so i am spending some time learning about it. So i just built my first Hello Flex portlet.



This portlet is very simple it is just including a Flex object in the output using object tag like this


<%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" session="false"%>
<%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<h4>Hello Adobe Portlet</h4>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="HelloWorld" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/HelloWorld.swf") %>' />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/HelloWorld.swf") %>" quality="high" bgcolor="#869ca7"
width="100%" height="100%" name="HelloWorld" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>


I used Adobe Flex Builder to build my first HelloWorld.swf application. My application does not have any action script so it just one page and the layout is defined by Helloworld.mxml which looks like this

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:aral="*" >
<mx:Panel title="My Application"
paddingTop="10"
paddingBottom="10"
paddingLeft="10"
paddingRight="10"
>
<mx:Label text="Hello World!" fontWeight="bold" fontSize="24"/>
</mx:Panel>
</mx:Application>


Once the HelloWorld.mxml was ready i used the Flash Builder to build HelloWorld.swf file from it and then copied the HelloWorld.swf in the root of my portlet application and then used renderResponse.encodeURL() for creating path to the HelloWorld.swf.