over 3 years ago

有 ContentLength 的寫法

public void Writeoff(HttpServletRequest request, HttpServletResponse response) throws Exception{
  ServletInputStream inStream = request.getInputStream(); //取HTTP請求流

  int size = request.getContentLength(); //取HTTP請求流長度

  byte[] buffer = new byte[size];
  inStream.read(buffer); //讀取buffer長度的資料,存在buffer,並回傳其長度

  String alldata = new String(buffer, "big5");
  //alldata 就是request帶來的所有資料,內容要自己分析

}
← 簡易寫檔方式 jasperreport and ireport use javabean in 5.5 →
 
comments powered by Disqus