1. First open your netbeans IDE and choose to create wed application (next) for java web)
2. Write your project name and select the path (next)
3. for java ee, select java ee5 (finish)
4. After completing the preceding steps, right-click (projectname) to create a schema-based REST-style web..., select simple, and click next
Change to text/plain. (finish)
2. download a file (blazeds.rar) and decompress it:
Address: Baidu click OK
Copy the decompressed file to WEB_INF in your netbeans project. Modify the remoting-config.xml in lib:
<? Xml version = "1.0" encoding = "UTF-8"?>
<Service id = "remoting-service"
Class = "flex. messaging. services. RemotingService">
<Adapters>
<Adapter-definition id = "java-object" class = "flex. messaging. services. remoting. adapters. JavaAdapter" default = "true"/>
</Adapters>
<Default-channels>
<Channel ref = "my-amf"/>
</Default-channels>
<Destination id = "helloWorld">
<Properties>
<Source> com. ws. HelloWorlds </source>
</Properties>
</Service>
3. Create a class in the netbeans project: The helloworlds code is as follows:
Public helloworlds (){
}
Public String gethelloworld (string name ){
Return "hello" + name;
}
Public String validatepassword (string name, string password ){
Return NULL;
}
4. Start flexbudler:
The code for creating a project is as follows:
<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute">
<Mx: remoteobject id = "say" Destination = "helloworld">
</MX: remoteobject>
<Mx: Button x = "10" y = "48" label = "click" click = "remotingSayHello (event)"/>
<Mx: TextInput x = "60" y = "89" id = "tiName"/>
<Mx: Label x = "10" y = "91" text = "name:"/>
<Mx: Label x = "259" y = "91" text = "{say. getHelloWorld. lastResult}" id = "lblView" color = "# FCEE09"/>
<Mx: Script>
<! [CDATA [
Import mx. rpc. events. FaultEvent;
Import mx. rpc. events. ResultEvent;
Public function remotingSayHello (event: Event): void {
Var iname: String = tiName. text;
Say. getHelloWorld (iname );
}
]>
</Mx: Script>
</Mx: Application>
5. Save and run. click... OK ..
Note: it may not be detailed enough, but you can see the simple effect.