- JScript code
var imageList = new Ext.data.Store({ autoLoad:true, reader:new Ext.data.JsonReader({ totalProperty:'results', root:'items', fields:[ 'picName','picUrl' ] }), proxy:new Ext.data.HttpProxy({ url:"findImg_findPic.action" }) }) var tpl = new Ext.XTemplate( '<tpl for=".">', '<div class="thumb-wrap" id="{picName}">', '<div class="thumb"><img src="{picUrl}" title="{picName}"></div>', '</tpl>', '<div class="x-clear"></div>' );panel=========================items:[new Ext.DataView({ store: imageList, tpl: tpl, autoHeight:true, multiSelect: true, overClass:'x-view-over', itemSelector:'div.thumb-wrap', emptyText: 'No images to display'
------解决方案--------------------
草的 整个csdn 墨迹死了这个问题 我日了
------解决方案--------------------
现在都到4.0了呵呵最起码也得用个3.0啊.
------解决方案--------------------
我靠,这个lz人呢,难道gaoshanwlm你就是lz。
关键是看你的json咋拼的
WebRoot-->upload
http://xxx.xx.xx/Extjs_Hello3.2/upload/1315992845704.JPG试试。
这个url不就是么?红色部分这样获得
- Java code
String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
------解决方案--------------------
显示图片我一般是直接再写个action来处理,直接用img标签显示会有这个问题的
action写法
public String showImage() throws Exception {
// 根据图片地址构造file对象
File file = new File(imageUrl);
InputStream is = new FileInputStream(file);
Image image = ImageIO.read(is);// 读图片
String imageType = imageUrl.substring(imageUrl.lastIndexOf(".") + 1);
RenderedImage img = (RenderedImage) image;
OutputStream out = response.getOutputStream();
ImageIO.write(img, imageType, out);
out.flush();
out.close();
return null;
}
jsp页面
src='showImage.action?imageUrl="+imgUrl+"'/>