I spent a lot of effort to implement this function. Some of the following content is taken from the Internet. Here, we only record the problems we encountered for future reference.
1. Install myeclipse6.5 and set the JDK environment.
2. Install the flexbuilder Eclipse plug-in version. Select the path of myeclipse during installation. Select the eclipse folder under myeclipse6.5.
3. Find the sdks folder in the flexbuilder directory and copy it to the eclipse folder under myeclipse6.5, then configure the plug-in (or copy the features and plugins under eclipse under flexbuilder to the corresponding folder under the eclipse folder under myeclipse6.5 directory, or use other plug-in configuration methods, I suggest using the link folder and link file creation method)
4. When all the environments are ready, flex starts to communicate with Java. The procedure is as follows:
Http://blog.csdn.net/roc230/archive/2010/06/07/5652746.aspx
This is the blog of A csdn friend, which is very detailed. I will not describe it in detail here. It's just that we use blazed, not LCD.
Blazed: blazeds-turnkey-3.2.0.3978
Yes: http://flexorg.wip3.adobe.com/blazeds/3.0.x/milestone/3978
/Blazeds-turnkey-3.2.0.3978.zip (usually find the blazed file after decompression, put it under the tomcat installation directory webapps folder. For more information, see)
5. After the corresponding project is created, you can compile the corresponding program.
First, create a Java class
Package com. oraro. Flex;
Public class flex {
Public String saystring (string Str ){
System. Out. println ("Click here! ");
Return "hello" + STR;
}
}
Then modify the corresponding flex File
<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute">
<Mx: SCRIPT>
<! [CDATA [import MX. rpc. Events. faultevent;
Import MX. Controls. Alert;
Import MX. rpc. Events. resultevent;
[Bindable]
Private var helloresult: string;
Private function sayhelloto (): void {
Alert. Show (inputtext. Text );
Ro. saystring (inputtext. Text );
}
Private function resulthandler (Event: resultevent): void {
Helloresult = event. result as string;
}
]>
</MX: SCRIPT>
<Mx: remoteobject id = "Ro" Destination = "flex" result = "resulthandler (event)"/>
<Mx: hbox width = "100%">
<Mx: textinput id = "inputtext"/>
<Mx: button label = "Submit" Click = "sayhelloto ()"/>
</MX: hbox>
<Mx: Label text = "{helloresult}"/>
</MX: Application>
Then add
<Destination ID = "flex">
<Properties>
<Source> com. oraro. Flex. Flex </source>
</Properties>
</Destination>
The following content:
After the above work is completed, the communication between flex and Java is completed. Of course, the communication method is implemented through remoteobject.
6. Notes
Change the context root configuration under your flex server to the same name as your project.
Otherwise, an error is reported, such:
The 'HTTP: // localhost: 8080/webroot/messagebroker/amf' path is incorrect.
Faultcode: client. Error. messagesend faultstring: 'send failed' appears during compilation'
Faultdetail: 'Channel. Connect. Failed error netconnection. Call. Failed:
HTTP: Status 404: URL:
'Http: // localhost: 8080/webroot/messagebroker/amf.
Of course, you can also create a flex and javaweb project respectively, and then perform the corresponding configuration, which is not described here.