我真的難住這個: 這是我創建動態圖像的方法。Wicket 6 NonCachingImage不顯示在HTML中
private Image createImage(final String id, final byte[] imageData){
NonCachingImage chartImage=new NonCachingImage(id) {
private static final long serialVersionUID = 1L;
@Override
protected IResource getImageResource() {
return new DynamicImageResource(){
private static final long serialVersionUID=1L;
@Override
protected byte[] getImageData(Attributes attributes) {
String myImageStr = new StringBuffer(
WicketApplication.TOMCAT_IMAGE_DOC_BASE).
append("13835.jpg").toString();
File file = new File(myImageStr);
try {
return Files.readBytes(file);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
};
}
};
chartImage.setOutputMarkupId(true);
chartImage.setOutputMarkupPlaceholderTag(true);
return chartImage;
}
這是我使用它
圖像IMG =的createImage( 「orig_photo」,uploadedFile.getBytes()); pnlForm.addOrReplace(img);
我的HTML
<img width="100" height="133" title="Photo" wicket:id="orig_photo"/>
得到這個錯誤:
得到這個錯誤在Javascript檢查元素: GET https://localhost/admin/admnwtxtprofile?5-IResourceListener-wProfileTxtPnl-wProfileTxtForm-orig_photo&antiCache=1439492929071 404(未找到)