Thread: CSS link in JSP

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    12
    Rep Power
    0

    Question 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.

    any ideas.
  2. #2
  3. :(){ :|:&};:
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Germany
    Posts
    297
    Rep Power
    11
    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?
    regards >_<

    ws. fgeller.de
    em. felix@fgeller.de
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    12
    Rep Power
    0
    hey
    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>?
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    12
    Rep Power
    0
    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.
  8. #5
  9. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    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.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    12
    Rep Power
    0
    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

IMN logo majestic logo threadwatch logo seochat tools logo