1.估计是典型的中文问题,用String name = new String( req.getParameter( "name" ).getBytes( "ISO8859_1" ), "GBK" );试一下看看。
2.用rs.getBytes(int i);得到字节数组,通过流的形式发回浏览器。
name设置为.doc,客户那如果有word就直接打开了,要不就显示个文件下载对话框。
private void writeStream( HttpServletResponse res, byte[] file, String name ) throws IOException
{
res.setContentType( "application/x-msdownload" );
res.setHeader( "Content-Disposition", "inline; filename="+name );
ServletOutputStream os = res.getOutputStream();
os.write( file );
os.flush();
os.close();
}
2.用rs.getBytes(int i);得到字节数组,通过流的形式发回浏览器。
name设置为.doc,客户那如果有word就直接打开了,要不就显示个文件下载对话框。
private void writeStream( HttpServletResponse res, byte[] file, String name ) throws IOException
{
res.setContentType( "application/x-msdownload" );
res.setHeader( "Content-Disposition", "inline; filename="+name );
ServletOutputStream os = res.getOutputStream();
os.write( file );
os.flush();
os.close();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货