日期:2014-05-17 浏览次数:20866 次
InputStream is=new FileInputStream(upload);
OutputStream os=new FileOutputStream("d:\\upload\\"+uploadFileName);
byte[] buffer=new byte[1024];
int count=0;
while ((count=is.read(buffer))>0) {
os.write(buffer, 0, count);
}
os.close();
is.close();
String path="d:\\upload\\"+uploadFileName;
b2.setPhoto(path);
if (path.length()>0) {
System.out.println("取得图片地址"+path);
}else {
System.out.println("图片地址为空");
}
bookDao.addBook(b2);
this.setMessage("添加成功!");
return SUCCESS;
<td><image id="image" src="<s:property value="#book.photo"/>" width="100" height="120"/></td>