showlist.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml" verticalGap="20" horizontalAlign="center" width="1024" fontFamily="宋体" fontSize="13">
<mx:HTTPService id="employeeSrv" showBusyCursor="true" url="
employees.jsp">
<mx:request>
<deptId>{dept.selectedItem.data}</deptId>
</mx:request>
</mx:HTTPService>
<mx:TitleWindow title="HTTPService" horizontalAlign="center" height="299" width="662">
<mx:HBox horizontalAlign="center">
<mx:Label text="选择部门:"/>
<mx:ComboBox id="dept" width="150">
<mx:dataProvider>
<mx:Array>
<mx:Object label="工程部" data="ENG"/>
<mx:Object label="产品管理" data="PM"/>
<mx:Object label="市场部" data="MKT"/>
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
<mx:Button label="查询" click="employeeSrv.send();"/>
</mx:HBox>
<mx:HBox width="100%" height="211">
<mx:DataGrid dataProvider="{employeeSrv.lastResult.employees.employee}" width="100%" height="198">
<mx:columns>
<mx:Array>
<mx:DataGridColumn dataField="name" headerText="姓名"/>
<mx:DataGridColumn dataField="phone" headerText="电话"/>
<mx:DataGridColumn dataField="email" headerText="邮件"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:HBox>
</mx:TitleWindow>
</mx:Application>
employees.jsp:
<?xml version="1.0" encoding="utf-8"?>
<employees>
<%
String deptId=request.getParameter("deptId");
if (deptId.equals("ENG")) {
%>
<employee>
<name>乔王晨玉</name>
<phone>555-219-2270</phone>
<email>qzc1998@fictitious.com</email>
</employee>
<employee>
<name>Louis Freligh</name>
<phone>555-219-2100</phone>
<email>lfreligh@fictitious.com</email>
</employee>
<%
} else if (deptId.equals("PM")) {
%>
<employee>
<name>Ronnie Hodgman</name>
<phone>555-219-2030</phone>
<email>rhodgman@fictitious.com</email>
</employee>
<employee>
<name>Joanne Wall</name>
<phone>555-219-2012</phone>
<email>jwall@fictitious.com</email>
</employee>
<%
} else if (deptId.equals("MKT")) {
%>
<employee>
<name>Maurice Smith</name>
<phone>555-219-2012</phone>
<email>maurice@fictitious.com</email>
</employee>
<employee>
<name>Mary Jones</name>
<phone>555-219-2000</phone>
<email>mjones@fictitious.com</email>
</employee>
<%
}
%>
</employees>