August 20th, 2003, 02:12 PM
CSS link in JSP
for some reason my <link> tags to css files are ignored in my jsp's. my styles are ignored and i get the defaults.
August 20th, 2003, 02:18 PM
how do you know it only does not work for jsp's?
does the style file really exist?
is it the correct path? did you consider the "\" and "/" ?
Could you post some code to make this easier to understand?
Is your CSS syntax correct?
August 20th, 2003, 02:26 PM
yeah...the thing is...i created the jsp without any java code, only html saved as a .jsp , thn when i started coding the Java into it, it started ignoring the css . so the CSS is fine, it worked, until i started adding the Java.
is there a specific place where i have to add the <link> tag, eg. before the <body>, in the <head>?
August 20th, 2003, 02:50 PM
maybe this is the problem :
when i access the jsp directly(typin in the path in browser), it applies the link style sheet.
however, i access the jsp via a servlet with a RequestDispatcher, and when i do it this way it ignores the stylesheet.
August 20th, 2003, 02:52 PM
the link tag goes in the head. Post your link tag. Is the URI a relative path? If so, relative to what - the document or the web root? One problem could be that you are not accounting for the context path of the app server.
August 20th, 2003, 02:58 PM
i tried different paths, it was relative path. the css file is in the root diretory of my web-app. i had the path as "transpay.css" , changed it to "../transpay.css" and now it works.
thanks for the help