Add power of Flex to Struts application

July 23, 2008

Anirudh S from Adobe, Bangalore created an awesome library using which you can change your existing Struts applications to use Flex as frontend. You just have to copy few jars and JSPs and that’s it, you need not make any changes to your Action classes. You should have a look at this library. Please check out more details from the URL below.

Tutorials on integrating Flex with Struts:

Tutorial on Integrating Flex with Struts based application using HTTP Service

Tutorial on Integrating Flex with Struts based application using Remoting

Enjoy 🙂 🙂

Flex 4 (Gumbo) is here

July 15, 2008

Next version of Flex, code named Gumbo is available for download. You can find more details at this URL

Gumbo primary themes:

Gumbo Architecture Whitepaper:

Feature specifications:

Download Gumbo builds from

🙂 🙂

Creating BlazeDS channels at runtime

July 3, 2008

Usually we create channels in services-config.xml and give URL to channel end points in the same file. This is good if the server IP or the domain name will not change. What if we are developing on our system and deploying to the production server? We need to change the end point URL in the services-config.xml and recompile our application.  It will be great if you can change the end point URL at one location and the Flex application will start using that URL without a need for recompiling the application.

Solution is simple you will have to create channels on runtime. This is very straight forward and easy.  🙂 You need not even add your services-config.xml to the compiler arguments.

I created a sample application which will access a XML file and then create the channels based on the settings in the configuration file.

XML configurations file with channel details

I created a XML file which has details of the channels which my application has to create. If you see the snippet extracted from the XML file it has definition for AMF channel. In the definition the id is the ID of the channel configured in the services-config.xml file on the server and the endpoint node has the URL to the end point.

Download XML from this URL: ChannelsConfiguration.xml



<channel id=”my-amf”>






Creating Flex application

Download MXML file from this URL: DynamicChannels.mxml

Now that I have a XML file with details of the channel my application will be using. I loaded this file when my application starts and create required channels so that my application can communicate with the server for using Remoting/Messaging/Proxy/Data management services provided by LCDS/BlazeDS.

Once the application is created function named loadConfiguration() is invoked which will make a HTTP Service request to get the XML file. Check out the function, it is pretty straightforward HTTP Service call.

When the XML is retrieved I parse the XML file and create channels in the parseConfigurationFile() function. Below are few statements extracted from the parseConfigurationFile() function which are worth explaining J

First I create a new channel.

_amfChannel = new AMFChannel(channel.@id, channel.endpoint);

Next add this channel to the ChannelSet.

amfChannelSet = new ChannelSet();


That’s it we have created the channel sets which we will be using in the RemoteObject call later. I created more channels

Now that I have the channel sets I need to instruct my RemoteObject to use this channel sets when it is trying to communicate with the server. This is how you do it.

<mx:RemoteObject id=”rmObj” destination=”MySessionHandler”





That is all you need to do 🙂 you can invoke operations on RemoteObject as usual. This applies to RemoteObject/Consumer/Producer/DataService 🙂