BlazeDS + J2EE Example

Now suppose you have already setup BlazeDS in your J2EE App Server, let's say Tomcat here.

in your Flex's main.mxml, you have something like

<mx:RemoteObject id="srv" destination="product"/>

<mx:Button label="Get Data" click="srv.getProducts()"/>   

You see here we define a RemoteObject whose destination is "product", what's is "product"?

You should find "product" in blazeds\WEB-INF\flex\remoting-config.xml

    <destination id="product">
        <properties>
            <source>flex.samples.product.ProductService</source>
        </properties>
    </destination>

You see here we link product to a Java class called ProductService. So really, in main.mxml, when you call "srv.getProducts()", it's really calling ProductService.getProducts().

Now you see, how we could use Java class in Flex.