'why my external css file not loading with html file on my tomcat server

I am beginner and I don't know why my external studentinformation.css file is not loading when I run my Signup.html on tomcat 3.2 or above but loads when I right click and open my html file with the chrome browser. Both of my html and css files are in WEB-INF folder. No error in the console for css. A screeshot for the reference of my eclipse ide



Solution 1:[1]

Try removing the (.) and the (/) when linking to your css file.

Solution 2:[2]

I tried on latest version of tomcat server v10.0 and my external css works fine on it. Older versions of tomcat only runs internal and inline css.

Solution 3:[3]

  1. wrap your html and css files in a file named (for example: presentation )
  2. put presentation file under webapp folder
  3. let your index.html be located under webapp without wrapping it in the presentation file. (addressing in index.html must be like: href:"presentation/style.css")
  4. make sure to perform "mvn clean" and prevent browser from caching the previous contents in order to get the proper result.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Elikill58
Solution 2 Chandan Yadav
Solution 3 mahsa najaei