NetBeans restful interaction with flex

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.