java

位置:IT落伍者 >> java >> 浏览文章

Java+Flex整合应用简单示例


发布日期:2023年01月31日
 
Java+Flex整合应用简单示例

java

Java代码

package com;

public class LoginDemo {

public String validate(String usernameString password){

String message =login failed!;

if(usernameequals(lin)&&passwordequals(lin)){

message = login successed!;

}

return message;

}

}

remotingconfigxml

Java代码

<?xml version= encoding=UTF?>

<service id=remotingservice

class=ssagingservicesRemotingService>

<adapters>

<adapterdefinition id=javaobject class=ssagingservicesremotingadaptersJavaAdapter default=true/>

</adapters>

<defaultchannels>

<channel ref=myamf/>

</defaultchannels>

<destination id=login>

<properties>

<source>comLoginDemo</source>

</properties>

</destination>

</service>

mxml

Java代码

<?xml version= encoding=utf?>

<mx:Application xmlns:mx= layout=absolute>

<mx:Script>

<![CDATA[

import mxrpceventsFaultEvent;

import mxrpceventsResultEvent;

import ntrolsAlert;

[Bindable]

var returnValue:String;

var username:String;

var password:String;

function sendRequest():void{

username=usernametext;

password=passwordtext;

rovalidate(usernamepassword);

roaddEventListener(ResultEventRESULTresults);

}

function results(event:ResultEvent):void{

returnValue=eventresult as String;

}

function faultHandler(event:FaultEvent):void{

Alertshow(eventfaulttoString());

}

]]>

</mx:Script>

<mx:RemoteObject id=ro destination=login fault=faultHandler(event)>

</mx:RemoteObject>

<mx:Panel height= width= layout=absolute title=用户登录>

<mx:Label x= y= text=用户名 width=></mx:Label>

<mx:Label x= y= text=密码 width=></mx:Label>

<mx:TextInput id=username x= y=/>

<mx:TextInput id=password x= y=/>

<mx:Button x= y= label=登录 click=sendRequest()/>

<mx:Label x= y= text={returnValue}/>

</mx:Panel>

</mx:Application>

               

上一篇:为Java创建Pair类

下一篇:Java处理PFX格式证书