Can anyone tell me if I can get Tomcat to use cascading style sheets? I have a .css file in the root of my production folder and I've tried referencing the .css file with and without a leading "/", but neither works. Thanks ion adance for anyone's help in this area. -- Mike
It shouldn't be tomcat that is the issue. If the CSS is valid, and referenced correctly, then your browser will take care of loading the CSS. If you don't see it working on a page, check the CSS link, and then check the CSS file for the correct syntax.
Joined: Jul 12, 2002
I did this already, but I must have missed something. Thank you for your reply. -- Mike
As has been said, this is not specifically a Tomcat issue. Do a view source and check your css location. Copy it into your browser URL bar. Can you load it? Probably not... Define "in the root of my production folder" -- where is this in relation to your page trying to load it? Where is the context root looking? Something else to check are that the file is readable by the id starting Tomcat. Also double check that your file is where you think it is... I had this exact problem today--dropped a file in the parent directory instead of where I thought I put it.
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
i have faced the same problem.. Directory names and stylesheet name of ur css file should be case sensitive ..check it out..they are the culprit.. my css path is <link rel="stylesheet" type="text/css" href="/raj/stylesheet/Style.css"> raj = context path stylesheet = directory for keeping all my css Style.css = name of css file first i kept the css file name as style.css and it was not working..make all cross checks..it wll surly work all the best raj SCJP2
SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
Joined: Jul 12, 2002
Thanks for all the great replies. The thing Tomcat didn't appear to like was the "\" leading back to the site root. Once I either removed the leading backslash or used ..\ notation, things worked out fine. One note which I don't know is meaningful relative to the CSS problems I was having is that I used Dreamweaver MX for a lot of the HTML grunt work. Thanks again for all the great info and replies! -- Mike
Dreamweaver is tempting to use because of how easily you can get great HTML effects with it, but it makes a mess of the HTML code. If you use Dreamweaver, be prepared to go in and clean up your HTML afterward, for exactly the kind of reason you're talking about. The other thing you can do is use Dreamweaver to get the effect you want, then go in to the code and see how it did it, and then make your real page with nice, clean HTML.
If you prep correctly and set Dreamweaver up correctly, it does not mess up your HTML code. The best thing to do with Dreamweaver is create a local test site that is a mirror of your production site. Then all your links will be relative to the appropriate location and you wont run into "/" problems. Sorry to highjack, just had to defend Dreamweaver a bit. It's the only reason I use Windows.