tags:

views:

1130

answers:

5

I have my .jsp file and when I put background image in some of the tags it doesn't appear there.

I put images in .jsp with css:

background:#233C9B url("design/header.gif");

folder structure is:

 css:
-->file.css
-->design:
-->header.gif

if I rename .jsp in .html the picture appears in browser but when I start it with tomcat and .jsp, it doesn't.

PS. I am using eclipse ee with tomcat in it.

+1  A: 

Did you see if you can access the image manually, outside the site, when running it with Tomcat? The problem could be that Tomcat handles the URL differently and the browser can't find the file.

Jani Hartikainen
hmm..i cant resolve where the aplication points in folder tree..when i upload picture on internet and write this background:url("http://www.imagesforme.com/out.php/i587683_header.gif")..it works..im just frustrated..and upload on internet is not solution..at least not a good one..
shake
+1  A: 

Also, try closing out all instances of the browser, and reopening it. You might be seeing a caching issue (maybe you should try this first?)

I would not trust eclipse's build process EVER. And by that I mean even if your change is simply a jsp change and not a java file that would need to be recompiled, DONT trust eclipse. Often, files that need to be overwritten, or include files that need to be copied, will not do so.

After checking your code/logic go through the build process one thing at a time. Shut down the webserver, clean your build, even go into the source area and delete the war file distribution, build it again, then start the webserver.

Matt1776
i agree with u..eclipse ee is not to be trusted..but i tried what you suggested..and it did not worked..ill just keep on trying..
shake
A: 

Have you tried putting a / in front of your image path to see if that helps? You shouldn't have to based on what I see above but I know very little about your setup.

You should also open up FireBug or use Tamper Data (Firefox plugin) to find out what path the browser is using to try and load that file. When I don't see CSS spec'd background images loading properly it almost always helps me find the reason why. In my case it's usually a typo.

SystemOut
A: 

I have FireBug now i don't know how to find out the path browser is inspecting. Where should I click in it?

A: 

Just open up Firebug and go to the "Net" panel. Next, reload the page in question and you should see all the requests it makes along with their HTTP status codes. When you hover over each request it should give you full URL it used to access that resource.

SystemOut