专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Java Web开发

Extjs DataView 图片显示不出 进来就有分 呀 多谢大家了

发布时间:2010-05-31 06:59:42 文章来源:www.iduyao.cn 采编人员:星星草
Extjs DataView 图片显示不出 进来就有分 呀 谢谢大家了
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+"'/>
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: