Earlier this week I blogged an example of Flex embedded in ColdFusion. This is a powerful and intuitive way to leverage Flex, but the installation and setup do require some know-how and manual tweaking. So, having gone through the process, and knowing that many of you will want to do the same, I thought I should share the process (just the high-level overview for now).
1: ColdFusion is a Java application, so is Flex (for now). Both ColdFusion and Flex are installed on top of J2EE servers. When ColdFusion MX Enterprise is installed there are three installation types presented as options, the 2nd installs JRun and a ColdFusion instance deployed on top of it, and the 3rd creates a ColdFusion archive (EAR or WAR) for deployment on top of an existing J2EE server. To use Flex with ColdFusion this type of install is required, standalone install (and thus ColdFusion Standard) will not support the deployment of Flex. So, first of all, ColdFusion must be deployed and running on top of a J2EE server.
2: Flex comes with an installer which actually does not really install Flex at all. What it does do is create WAR files for deployment on top of a J2EE server (like JRun). The installer created a folder and deposits several files in it, one of those is named flex.war and it is that file that contains Flex itself and needs to be deployed on the J2EE server. The exact steps to deploy flex.war vary based on the J2EE server being used. There are J2EE management tools that may be used to deploy WAR files, or you may simply expand the war file (using the jar utility) so that it may be detected by the J2EE server.
3: In order to embed Flex MXML (via the Flex JSP Tag Library) in your CFML code, Flex must be deployed in the same server and context as ColdFusion itself. So, if you deployed ColdFusion MX into a context named “cf”, Flex will need to deployed into “cf” as well. The simplest way to do this is to manually expand flex.war into the same folder in which ColdFusion itself was expanded.
4: In the application’s WEB-INF folder there is a file named web.xml, this file contains application information needed by the J2EE server so as to be able to deploy the application in the folder. ColdFusion installs its own web.xml, and Flex comes with one too. These contents of these two files must be merged (as only one web.xml may exist).
5: Then simply restart the server, and both ColdFusion and Flex will be deployed. You can then create .cfm files, .mxml files, and also embed the Flex JSP Tag Libraries within your CFML code.
Leave a Reply