Flex与Servlet之间数据的交互
总结一下Flex与Servlet之间数据的交互:
代码1—Flex代码:
代码2—Servlet代码:
package com.ghj.packageofservlet;
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 {
private static final long serialVersionUID = -2928176190622974743L;
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/pain;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String name = request.getParameter("name");//获取Flex发送回来的名为name的参数对应的参数值
System.out.print("name:" + name);
out.println("Servlet获取的值为" + name);
} finally {
out.close();
}
}
} 代码3—web.xml代码:
TestServlet
com.ghj.packageofservlet.TestServlet
TestServlet
/TestServlet
index.jsp
代码4—jsp代码:
Flex与Servlet的交互 【0分下载示例】
http://www.dengb.com/Javabc/894347.htmlwww.dengb.comtruehttp://www.dengb.com/Javabc/894347.htmlTechArticleFlex与Servlet之间数据的交互 总结一下Flex与Servlet之间数据的交互: 代码1—Flex代码: 代码2—Servlet代码: package com.ghj.packageofservlet;import ja...