reset password
Author Message
khsu
Posts: 30
Posted 13:51 Nov 26, 2015 |

I'm trying to add a CSS file to my JSP page, but it seems like I have to do something in the controller first before I can do it. 

Here's the code linking the CSS in the JSP page. 

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

The JSP page's directory is WEB-INF/homework2/MyNotes.jsp

The CSS I'm trying to link it to is in WEB-INF/lib/Jot.css

Last edited by khsu at 13:51 Nov 26, 2015.
acervantes
Posts: 28
Posted 11:48 Nov 29, 2015 |

Using relative paths can be tricky.

when linking to external CSS or JS pages using a relative path, it must be relative to the location that the browser thinks the view is in. That is to say that you should not link relative to the physical location of the JSP. Instead, link relative to the URL that shows up in the browser window.