This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes problem with images in html page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "problem with images in html page" Watch "problem with images in html page" New topic
Author

problem with images in html page

shippu devaraju
Greenhorn

Joined: Feb 26, 2002
Posts: 11
Hi Friends,
I have written a program to send Html page throgh mail,using java mail package.in that what i did is, in my java program i am reading Html file with Buffer Reader.if there is no image in my html it is working fine. but if html have any image that image is not displaying in mail(i.e o/p). in image's place only white box is coming.
I would be thankfull to you if you can give a solution for me.
with the following code i am reading html file
String line;
String filename = "example3.html";
try{
BufferedReader in =
new BufferedReader(
new FileReader( filename ) ); //
System.out.println( "Reading..." );
while ( ( line = in.readLine() ) != null ) {
line1=line1+line;
}
}catch(Exception e){}
all my java file,htmlfile,*.gif file are in a local folder i.e c:/shippu/examples/
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"shippu",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

I'd be willing to bet that in the HTML you are generating that the image URL is a relative reference. Check the generated HTML and you should be able to see if this is the case.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I was thinking that you are trying to read binary data (ie an image) using a BufferedReader - ie chars.
Try converting to Streams instead.
Dave.
 
jQuery in Action, 2nd edition
 
subject: problem with images in html page