Creating Flex project with BlazeDS Launch the Adobe Flex Builder 3 Eclipse Launcher and create a new project through File > New and then selecting Others that will open up a wizard. In that wizard, expand the Flex Builder node and select Flex Project option and click on 'Next'. The wizard leads to New Flex Project window, here provide the project name as 'PcqDemo', select application type as web application and select server type as J2EE, since we are using Java at server side. Also make sure that the option for Use remote object access service is checked and the LifeCycle Data Services option is also selected. Click on 'Next' to proceed to configure the J2EE server.
Under J2EE settings, select the target runtime as Tomcat (in our case), and where the wizard asks for Flex war file, browse to the location where you have extracted the blazeds.war. Once the war file is selected, click on 'Finish' so that Flex Builder can create the project, and when completed will also prompt you to switch the development perspective to Flex. When the project is created, the IDE will open up the main application and the main MXML file will be named same as the project, i.e. PcqDemo.mxml.
During the J2EE Server configuration step, add Apache Tomcat as target runtime and browse for 'blazeds.war' and provide the same as Flex WAR file.
We also need to add the project to the Server, a simple way is to first add the server view to Flex development perspective. To add Server view, go to Windows > Show view > Other > Servers and click on 'OK'. This will add the Server view panel to the Flex development perspective environment.
In our case it will display Tomcat Server. Now to add the project 'PcqDemo' to the server, right-click on the listed server and select 'Add and Remove Project' option. From the Add and Remove Project wizard, select the project 'PcqDemo' and add it to the server.
Creating Remote Java Object BlazeDS has a feature of providing RPC Services, through which a client can interact with Java Object on the server side. So we'll now create the server implementation for the project. To create the Java class, expand the PcqDemo project node in the Flex Navigator panel and right-click on 'src' folder. Select New > Other and then on the selection wizard, expand the Java node and select Class and click on 'Next'.
On following screen name the class as PcqDemo and give the package as 'com.pcq.demo' and upon clicking the 'Finish' button the PcqDemo.java file is created and opened in the editor view. Now we add the method to the code that accepts string as parameter from the request and returns it with Hello word appended to it, as follows:
package com.pcq.demo; public class PcqDemo { public String addHello(String name) { return "Hello " + name; }}
The Flex Builder Plug-in for Eclipse provides complete Flex development within Eclipse IDE. You can drag-drop components onto the designer directly & see both source and design of your project and much more.
Get most out of your technology infrastructure investments with Dell
About CIOL | Media Kit | Site Map | Contact Us | Help | Write to us | Jobs@CyberMedia | Privacy Policy
Copyright © CyberMedia India Online Ltd. All rights reserved. Usage of content from web site is subject to Terms and Conditions.