类似Xmlhttp获取数据的Flex方法~

发表于:2007-06-30来源:作者:点击数: 标签:
通信还是用httpservice 这和xmlhttp获得远端数据的方法是差不多的~ 简单例子如下: 1。servlet import java .io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doGet(HttpServletReq
通信还是用httpservice
这和xmlhttp获得远端数据的方法是差不多的~

简单例子如下:

1。servlet
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
{

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><head><title>");
out.println("This is my first Servlet");
out.println("</title></head><body>");
out.println("<h1>Hello,World!</h1>");
out.println("</body></html>");

}
}


2。mxml
<?xml version="1.0" encoding="gb2312"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" verticalGap="10">
<mx:HTTPService id="ws" url="http://localhost:8080/servlet/helloworld"
resultFormat="text"
method="POST"
contentType="application/xml">
</mx:HTTPService>

<mx:Button label="Getvalue" click="ws.send();"/>
<mx:TextInput id="myResult" text="{ws.result}" width="500" height="300"/>
</mx:Application>

原文转自:http://www.ltesting.net