This is FAQ and u would have got it from servlet archives
any way , here is the solution :-)


You generally don't want to hard-code the address of the images
unlessthey're on
a different server than the one serving up the servlets.  Thelocation of the

images in the html is based on where the reference is beingmade from.  There
are
two possibilities:  1) your "caller" is an html page,or 2) your caller
is a servlet.  Let's assume the following web virtualdirectories:


webServer                       ...web server/www

...web root/www/myProject          ...virtual directory for this project
/www/myProject/images   ...images for this
project/servlet
 ...virtual directory for the servlet engine



Too many people would say " http://webServer/myProject/images/abc.jpg
<http://webserver/myProject/images/abc.jpg> " -- toougly and restrictive
(imagine you work 2-3 months and create sever hundredpages with myServer
hard-coded and the boss says to install your site on"theirServer").
If your caller is an html page from the above project,you'll typically say
something like "images/abc.jpg". If you've rendered ahtml page from a
servlet, then you'd have to say"/myProject/images/abc.jpg".  You
definitely don't want to hard-code thefull url with the web server name in
there
since you'll probably need tomove the web app to another server.

Smiling,
~Gurramkonda Hemadri Naidu


 -----Original Message-----
From: NitinS [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ]
Sent: Wednesday, September 01, 1999 12:52 PM
To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Subject: Servlet problem for displaying image


Hi,
I am generating the HTML page from Servlet using "out.println" statement but
when I set the background image of this page
like

out.println("<BODY BACKGROUND=\"modetxt.gif\" LINK=\"black\" VLINK=\"black\"
>");

I have copied image files in servlet directory  and public_html in Java Web
Server 1.1.3 but this doesn't help me to get the image.



I tried



out.println("<IMG SRC=\"bkg_wb.GIF\" WIDTH=\"990\" HEIGHT=\"10\"
ALIGN=\"BOTTOM\" BORDER=\"0\"></P>");

out.println("<P ALIGN=\"CENTER\"><IMG SRC=\"importsoft.gif\" WIDTH=\"375\"
HEIGHT=\"60\" ALIGN=\"BOTTOM\" BORDER=\"0\"></P>");

out.println("<P ALIGN=\"CENTER\"><IMG SRC=\"bkg_wb.GIF\" WIDTH=\"990\"
HEIGHT=\"10\" ALIGN=\"BOTTOM\" BORDER=\"0\"></P>");



this code also but I am unable to load any image.



Please help me in this case.





thanks & regards.



Nitin





___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to