0

Using request dispatcher i forwarded the request to new Jsp page. The stylesheet is not loading when i use the following the lines

 < link rel="stylesheet" type="text/css" href="../css/style.css">

But Stylesheet is loading when i replace this line with

< link rel="stylesheet" type="text/css" href=request.getcontextpath()+"/css/style.css>

Can someone explain the difference clearly. Thanks in advance!!

Chandru Jc
  • 105
  • 10
  • 1
    `../` just means go up one directory, the other gets the root of your context. First one is relative and the other is not. – takendarkk Apr 14 '17 at 19:17
  • You can do the second one with `./`. – user886 Apr 14 '17 at 19:18
  • @Andrew Without seeing the folder structure of the project, how can you determine that the css folder is inside the current working directory? (which is what `./` indicates) – takendarkk Apr 14 '17 at 19:19
  • 1
    You can't necessarily do the second one with `./`. I originally misunderstood the return value of `request.getContextPath()`. – user886 Apr 14 '17 at 19:23

0 Answers0