利用servlet处理XMLHTTP提交的POST数据
来源:互联网 发布:金庸小说武功排名知乎 编辑:程序博客网 时间:2024/05/16 10:32
/*
* publishNews.java
*
* Created on 2007年8月28日, 下午3:57
*/
package com.dading;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* @author Administrator
* @version
*/
public class publishNews extends HttpServlet {
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String str=this.getStream(request);
out.println("返回:"+str);
out.close();
}
public String getStream(HttpServletRequest request) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8"));
StringBuffer ReString=new StringBuffer();
String tmp="";
while(true){
tmp=br.readLine();
if(tmp==null)
break;
else
ReString.append(tmp);
}
return ReString.toString();
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
// </editor-fold>
}
- 利用servlet处理XMLHTTP提交的POST数据
- 利用Servlet上传文件(在servlet中处理MIME类型的post数据)
- xmlHttp之post提交
- 静态页面提交post->servlet处理模式
- 利用XMLHTTP无刷新添加数据之Post篇.
- 利用XMLHTTP无刷新添加数据之Post篇
- 利用XMLHTTP无刷新添加数据之Post篇
- (转贴)利用XMLHTTP无刷新添加数据之Post篇.
- 利用XMLHTTP无刷新添加数据之Post篇.
- 利用xmlhttp无刷新添加数据之post篇.
- 利用XMLHTTP无刷新添加数据之Post篇(转载)
- 利用XMLHTTP无刷新添加数据之POST篇
- 利用XMLHTTP无刷新添加数据之Post篇.
- 利用XMLHTTP无刷新添加数据之Post篇
- 利用XMLHTTP无刷新添加数据之Post篇
- CppWebBrowser的使用二 利用Post提交数据
- post模拟表单数据提交--利用apache的jar包
- 如果利用XMLHTTP.SEND提交并利用ASP在后台接收所提交数据
- IT是民工还是笨球儿
- j2ee 轻量级开发模式
- Linux借机发力 到桌面仍需时日
- 建模的误区—— 走出一般性的设计误区,迈向成功之途
- Cache的几种过期使用样例
- 利用servlet处理XMLHTTP提交的POST数据
- SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; 异常解决
- WEB TEST
- Transact-SQL编程规范
- ActionServlet深入探讨
- 一位软件工程师的6年总结
- js的一些页面处理(iframe的高度可变,回车提交)
- Visual Studio.Net鲜为人知的技巧
- 房子现行记