flex与jsp通信
<mx:HTTPService id="clientIpDs" url="http://192.168.10.135:8080/flcds/getIP.jsp" useProxy="false" showBusyCursor="true" resultFormat="text" method="POST" result="dealResult(event)" fault="alss(event)"></mx:HTTPService>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%String clientIP = request.getRemoteHost();response.getWriter().print(clientIP); %>
<mx:Script><![CDATA[import mx.rpc.events.FaultEvent;import mx.rpc.events.ResultEvent;import mx.events.CloseEvent;import mx.controls.Alert;import mx.events.ListEvent;import mx.collections.ArrayCollection;[Bindable]private var req_url:String = "http://192.168.10.135:8080/flcds/getIP.jsp";//询问是否与对方建立视频private function ask(evt:ListEvent):void{this.clientIpDs.send();var selectItem:Object = evt.currentTarget.selectedItem;Alert.show("确认请求与"+selectItem.username+"视频吗?","提示",Alert.OK|Alert.CANCEL,this,doRequest);//处理请求function doRequest(evt:CloseEvent):void{if(evt.detail == Alert.OK){}}}//处理获取的客户端IPprivate function dealResult(event:ResultEvent):void{Alert.show("请求成功......","提示");var cIp:String = event.result as String;Alert.show(cIp);}private function alss(event:FaultEvent):void{Alert.show("请求失败......","提示");}]]></mx:Script>