开发者

Image servlet file delivery completion event

Suppose there is a 4.3 mb png file.I used Balus c Image servlet to show the image inline in my jsp page.But the file being 4.3mb in size takes time to download.I would like t开发者_JS百科o show a loading gif in the meantime and keep the image hidden by setting its style as "display:none;".The question is how do i know that the image has been delivered completely by the servlet before rendering the image.


You can put the url of your gif image in the html produced by the jsp, then fetch the image at load time:

$(function() {
    var loadr = new Image();
    $(loadr).load(function() {
        $("#myimg").attr("src", this.src);
    });
    loadr.src = "servletUrl";
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜