The code in ***daoimpl.java is as follows
Copy Code code as follows:
Public String Getcompuname ()
{
map<string, string> map = system.getenv ();
String computerName = Map.get ("ComputerName");//Get Computer name
return computerName;
}
Public String GetIP ()
{
InetAddress addr = null;
try {
addr = Inetaddress.getlocalhost ();
}
catch (Unknownhostexception e)
{
E.printstacktrace ();
}
String IP = addr.gethostaddress (). toString ();//Get native IP
return IP;
}
Need to introduce
Copy Code code as follows:
Import Java.util.Map;
Import java.net.InetAddress;
Import java.net.UnknownHostException;
Flex Foreground Code
Copy Code code as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<s:application xmlns:fx= "http://ns.adobe.com/mxml/2009"
Xmlns:s= "Library://ns.adobe.com/flex/spark"
xmlns:mx= "Library://ns.adobe.com/flex/mx" xmlns:supportclasses= "com.esri.ags.skins.supportclasses.*" minWidth= " 955 "minheight=" creationcomplete= "init ()" >
<fx:Script>
<! [cdata[
Import Mx.controls.Alert;
Import mx.rpc.events.FaultEvent;
Import mx.rpc.events.ResultEvent;
Public function init (): void
{
Ipandpcname.getcompuname ();
Ipandpcname.getip ();
}
Public Function Ipandpcname_faulthandler (event:faultevent): void
{
Alert.show (Event.tostring ());
}
Public Function Getcompuname_handler (event:resultevent): void
{
Alert.show (Event.result.toString ());
}
Public Function Getip_handler (event:resultevent): void
{
Alert.show (Event.result.toString ());
}
]]>
</fx:Script>
<s:layout>
<supportClasses:AttachmentLayout/>
</s:layout>
<fx:Declarations>
<!--place non-visual elements (such as services, value objects) here-->
<mx:remoteobject id= "Ipandpcname" destination= "systemconfaction" fault= "Ipandpcname_faulthandler" (event) >
<mx:method name= "Getcompuname" result= "Getcompuname_handler (event)"/>
<mx:method name= "GetIP" result= "Getip_handler (event)"/>
</mx:RemoteObject>
</fx:Declarations>
</s:Application>