我工作的GWT和下面是我的代碼:檢索通過圖片src網址的圖像GWT
if(rs1.next()){
int len = imgLen.length();
byte [] rb = new byte[len];
InputStream readImg = rs1.getBinaryStream(1);
int index=readImg.read(rb, 0, len);
System.out.println("hello");
System.out.println("index"+index);
//st.close();
response.reset();
response.setContentType("image/png");
System.out.println("response"+response);
int len3 = 0;
while ((len = readImg.read(rb)) != -1) {
response.getOutputStream().write(rb,0,len);
System.out.println(response);
}
我用這個代碼在服務器端檢索從MySQL數據庫中的圖像。它在客戶端的響應是「IMG src =」http:// some path:8888/m/upload「url。那麼有人知道如何在客戶端檢索圖像嗎?
對於GWT 2.2:http://google-web-toolkit.googlecode.com/svn/javadoc/2.2/com/google/gwt/user/client/ui/Image.html – 2011-03-18 15:45:48