读取本地图片写到jsp页面
时间:2014-05-13 13:15:20
收藏:0
阅读:305
//读取本地图片写到jsp页面
File file = new File("D:/parking/A区12号.jpg");
ServletOutputStream out = null;
InputStream in = null;
try {
in = new FileInputStream(file);
response().setContentType("multipart/form-data");
int tempbyte;
out = response().getOutputStream();
while ((tempbyte = in.read()) != -1) {
out.write(tempbyte);
}
out.flush();
} catch (IOException e) {
e.printStackTrace();
} finally{
if(in != null){
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if(out != null){
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
//jsp页面
<img src=\‘#\‘" value="/vehicleParkInfo/inShowTDC/"/>
评论(0)