• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Servlets, HTML and GIFs

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a servlet that gets an HTML file that has some GIFs in it. The problem I am encountering is the page is retrieved, but the GIFs are not displaying.
The html page is in jakarta-tomcat-4.0.4/webapps/ROOT
The GIFs are currently in jakarta-tomcat-4.0.4/webapps/ROOT
The html references the GIFs similiar to <img src="myLogo.gif">
On my desktop the images show, however when deployed on the server the images do not show. How can this be corrected?
Randall
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you are specifying a relative reference to the images, the browser is trying to find them in the same folder as the page. However, since your page is emitted by a servlet, there really is no "page".
What the broser is doing is to use the URL of the servlet (probably a servlet mapping, no?) as the base for your relative references.
You will need to either use server-relative href's for your images, or use the <base> tag to provide a relative base for the images.
bear
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This discussion in Apache/Tomcat talks about the same thing (after post #3) , with regard to JSPs. But the general idea is the same as this discussion.
 
Don't listen to Steve. Just read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic