转自 http://pipe.**.com/blog/201938
首先,我们在eclipse中创建一个web project 取名为simple
在这个project中我们创建一个servlet:代码如下:
- package com.test;
- import java.io.IOException;
- import java.io.PrintWriter;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- public class TestServlet extends HttpServlet {
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- this.doPost(request, response);
- }
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- response.setContentType("text/html");
- PrintWriter out = response.getWriter();
- out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
- out.println("");
- out.println("");
- out.println("pubDate11111");
- out.println("title111");
- out.println("description111");
- out.println("");
- out.println("");
- out.println("pubDate222");
- out.println("title22");
- out.println("description122211");
- out.println("");
- out.println("");
- }
- }
这个servlet的访问地址为:http://localhost:8080/simple/test,
现在我们在flex buider3中创建一个flex project,选择web root为tomcat/webapps下面, 取名test.
新建一个connect.mxml文件 代码如下:
- <?xml version="1.0" encoding="utf-8"?>
- "http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="feedRequest.send()">
- "feedRequest" url="http://localhost:8080/simple/test"
- useProxy="false">
好了!访问一下:http://localhost:8080/test/bin-debug/connect.html
截图如下:
a2d441f0-3b35-33b6-b19c-5338cc0e12b5[1].JPG
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25432352/viewspace-690411/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25432352/viewspace-690411/