请教高手:在request对象中取得multipart/form-data格式的二进制数据是不是用request.getInputStream呀? 是不是InputStream abc = request.getInputStream();byte[] ggg;abc.read(ggg);这样呀? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 又或者byte[] ggg = new byte[1024];abc.readLine(abyte, 0, abyte.length);绝对能行。 啊,写错啦。byte[] ggg = new byte[1024];abc.readLine(ggg, 0, ggg.length); 建议你看一下这个极其简单的例子:public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = new PrintWriter (response.getOutputStream()); out.println("<html>"); out.println("<head><title>ShowFormdata</title></head>"); out.println("<body>"); out.println(request.getContentType()); out.println("<pre>"); BufferedInputStream in = new BufferedInputStream(request.getInputStream()); int c; while((c=in.read())!=-1) out.write(c); out.println("</pre>"); out.println("</body></html>"); out.close();} 万分感谢luodi(无知者无畏)和skyyoung(路人甲)!!!!!!!!!! 谢谢luodi大侠的例子! 怎样连接java db? 【高分求解】诡异问题:JComboBox可以下拉,但没有下拉箭头 关于登陆界面 SWT窗口和表格问题,请高人指点 setLocationRelativeTo 問題 JOptionPane生成的对话框如何屏蔽Esc键事件? IO流中数据流DATAINPUTSTREAM允许程序按着计算机无关的风格读取JAVA原始数据怎么理解? 路过的朋友请进 有个小问题请教下 Java中Object数组对象转型泛型对象数组 Java application如何访问Cookie 问个建立文件的问题?(很奇怪的) 如何学习输入输出I/O
byte[] ggg = new byte[1024];
abc.readLine(abyte, 0, abyte.length);绝对能行。
byte[] ggg = new byte[1024];
abc.readLine(ggg, 0, ggg.length);
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = new PrintWriter (response.getOutputStream());
out.println("<html>");
out.println("<head><title>ShowFormdata</title></head>");
out.println("<body>"); out.println(request.getContentType());
out.println("<pre>");
BufferedInputStream in = new BufferedInputStream(request.getInputStream());
int c;
while((c=in.read())!=-1)
out.write(c);
out.println("</pre>");
out.println("</body></html>");
out.close();
}
万分感谢luodi(无知者无畏)和skyyoung(路人甲)!!!!!!!!!! 谢谢luodi大侠的例子!