Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

problem with images in html page

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
Marshal
Posts: 67430
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Or we might never have existed at all. Freaky. So we should cherish everything. Even this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic