---
title: "flex请求服务"
author: "yaoweinan"
date: "2010-12-23T11:25:54Z"
tags: []
categories: ["Web前端"]
slug: "flex"
draft: false
lastmod: "2012-06-04T23:33:53Z"
id: 850019
url: "https://ilyon.iteye.com/blog/850019"
---

flex页面： 

其中：_url.action为用户定义的请求，该页面向struts2发送两个参数：userName,pswWord 


Xml代码 
<?xml version="1.0" encoding="utf-8"?>   
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#f6f6f6" backgroundGradientColors="" fontSize="12">   
    <mx:Label text="用户名:" x="23" y="61" id="txt"/>   
    <mx:TextInput id="userName" x="77" y="59"/>   
        
    <mx:Label text="密码:" x="35" y="91"/>   
    <mx:TextInput id="pswWord" x="77" y="89"/>   
        
    <mx:Button label="提交" click='my_HS.send()' x="185" y="121"/>   
        
    <mx:HTTPService id="my_HS" url="_url.action" method="post" >   
        <mx:request>   
            <userName>{userName.text}</userName>   
            <pswWord>{pswWord.text}</pswWord>   
        </mx:request>   
    </mx:HTTPService>   
</mx:Application>