开发者

why does web server display images corrupterd?

I have a page in JSP, which has a tag like: <img src="images/1.bmp"></img> The 1.bmp is like:

why does web server display images corrupterd?

But the image which looks in m开发者_StackOverflow社区y page, visited by firefox, is like:

why does web server display images corrupterd?

what should i do to fix this problem?


I've converted the images which you uploaded into your question back to BMP and investigated their source. Everywhere where a non-ISO-8859-1 character appears in the original source, a ? appears in the malformed source.

This means that you've a servlet on /images/* which uses response.getWriter() to write the image using the platform default charset. You shouldn't do that. BMP files are not text files. BMP files are binary files. You should be using response.getOutputStream() to write binary data. You can find a basic and proper example of an image servlet in this article.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜