Flex 与asp通讯

作者在 2006-08-04 00:14:00 发布以下内容

Mxml文件源码

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" creationComplete="userRequest.send()">
   <mx:HTTPService id="userRequest" url="http://localhost/lyb/php.asp" useProxy="false" method="POST">
      <mx:request xmlns="">
         <username>{username.text}</username><emailaddress>{emailaddress.text}</emailaddress>
      </mx:request>
   </mx:HTTPService>
   <mx:Form x="22" y="10" width="493">
      <mx:HBox>
         <mx:Label text="Username"/>
         <mx:TextInput id="username"/>
      </mx:HBox>
      <mx:HBox>
         <mx:Label text="Email Address"/>
         <mx:TextInput id="emailaddress"/>
      </mx:HBox>
      <mx:Button label="Submit" click="userRequest.send()"/>
   </mx:Form>
   <mx:DataGrid id="dgUserRequest" x="22" y="128" dataProvider="{userRequest.lastResult.users.user}">
      <mx:columns>
         <mx:DataGridColumn headerText="User ID" dataField="userid"/>
         <mx:DataGridColumn headerText="User Name" dataField="username"/>
      </mx:columns>
   </mx:DataGrid>
   <mx:TextInput x="22" y="292" id="selectedemailaddress" text="{dgUserRequest.selectedItem.emailaddress}"/>
</mx:Application>

 

asp文件源码

<%
username = request.Form("username") 
emailaddress = request.Form("emailaddress")

str ="<?xml version='1.0' encoding='gb2312'?><users>"& vbcrlf
str = str&"<user>"& vbcrlf
str = str&"<userid>1</userid>"& vbcrlf
str = str&"<username>"&username&"</username>"& vbcrlf
str = str&"<emailaddress>"&emailaddress&"</emailaddress>"& vbcrlf
str = str&"</user>"& vbcrlf
str = str&"</users>"& vbcrlf

response.Write(str)
%>

 

Flex | 阅读 967 次
文章评论,共0条
游客请输入验证码
浏览92521次