servlet
response.setContentType("utf-8");
response.setContentType("html/x-json;charset=utf-8");response.setDateHeader("expires", 0);
response.setHeader("Cache-Control", "no-cache");
response.setHeader("pragma", "no-cache");
List<AdminMessageEnty> list=new GetMessageDao().getMessage();
PrintWriter out =response.getWriter();
//XML解析
out.println("<?xml version='1.0' encoding='utf-8'?>");
out.println("<message>");
for(int i=0;i<list.size();i++)
{
AdminMessageEnty message=new AdminMessageEnty();
message=list.get(i);
out.println(" <xml>");
out.println(" <id>"+message.getId()+"</id>");
out.println(" <type>"+message.getType()+"</type>");
out.println(" <dept>"+message.getDept()+"</dept>");
out.println(" <title>"+message.getTitle()+"</title>");
out.println(" <content>"+message.getContent()+"</content>");
out.println(" <reply>"+message.getReply()+"</reply>");
out.println(" </xml>");
}
out.println("</message>");
out.flush();
out.close();
//flex接收数据
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="httpGetMess.send()">
<mx:HTTPService id="httpGetMess" url="http://localhost:8080/message/servlet/MessageServlet"></mx:HTTPService>
dataProvider="{httpGetMess.lastResult.message.xml}"