Reputation: 205
I have small Java EE web app developed in eclipse. I am using tomcat 6.0. In my application webcontent folder i have jsp folder and I have put all jsp files there.And I have css and JS folder which contains CSS and JS files.I have MVC design with single controller.From login page request go to controller and from there I am dispatching it to welcome.jsp.
I have welcome.jsp where i am linking css with this code link
href="css/stylesheet.css"
its working fine.
In that page I am using link a href="jsp/addEditUser.jsp" to go to addEdit user page.
On addEdit.jsp page also i m using same
href="css/stylesheet.css"" rel="stylesheet" type="text/css" /> but on that page it's not getting css. It gets css when i use href="../css/stylesheet.css"
why is it so..any solution..?
Upvotes: 0
Views: 1845
Reputation: 14123
Use absolute URLs like /css/stylesheet.css
(with leading slash) resolved from root of host.
Upvotes: 1
Reputation: 1024
there is no solution. your directory structure is like this :
- css
-- stylesheet.css
- jsp
-- addEditUser.jsp
the relative path from the jsp to the css is (parent directory)/css/stylesheet.css the ".." stands for parent directory.
Upvotes: 1