0

My servlet generates an HTML page using page templates. In this page, I have a path to a CSS file, but I could not find the right path. The structure of my project looks like this:

root
- src
-- *servlets*
- web
-- WEB-INF
--- CSS
---- style.css
--- template
---- basic.html

The basic.html template page contains <link rel="stylesheet" href="style.css">. What do I need to write in href for using my CSS file?

My project was created in IntelliJ and working on Glassfish 4.

iRomul
  • 251
  • 1
  • 7
  • 18

2 Answers2

1

You may want to look here. I find this way the most flexible. You can change your context root without a need to change your code and you do not have to think about constructing relative paths.

Community
  • 1
  • 1
jjd
  • 2,158
  • 2
  • 18
  • 31
0

You can include it from the very begging.

Path would be /root/src/css/Style.css

Or you can include it by backtracking the path ../css/Style.css

Andrew Rayner
  • 1,056
  • 1
  • 6
  • 20