title: Eclipse Dynamic Web Project Link CSS from JSP using Tomcat
body: <p>I have this Dynamic Web Project in Eclipse:<br>
  <a href="https://i.stack.imgur.com/UJ1jJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UJ1jJ.png" alt="Project tree screenshot"></a></p>
  
  <p>I want to link from home.jsp to home.css.</p>
  
  <p>Head of home.jsp:</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=UTF-8" %&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;&lt;head&gt;
  &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
      &lt;meta name="description" content="Infinance Home Webpage"&gt;
      &lt;meta name="author" content="Infinance"&gt;
  
  
      &lt;link rel="icon" href="img/infinance-web-icon_128.png"&gt;
      &lt;title&gt;Infinance: Inicio&lt;/title&gt;
      &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"&gt;
  
      &lt;link rel="stylesheet" type="text/css" href="css/home.css" /&gt;
  
    &lt;style id="style-1-cropbar-clipper"&gt;
  .en-markup-crop-options {
      top: 18px !important;
      left: 50% !important;
      margin-left: -100px !important;
      width: 200px !important;
      border: 2px rgba(255,255,255,.38) solid !important;
      border-radius: 4px !important;
  }
  
  .en-markup-crop-options div div:first-of-type {
      margin-left: 0px !important;
  }
  &lt;/style&gt;&lt;/head&gt;
  
  ...
  </code></pre>
  
  <p>I have tried a lot of solutions that I found in other StackOverFlow posts but the only one that it worked was:</p>
  
  <pre><code>&lt;style type="text/css"&gt;
    &lt;%@include file="css/style.css" %&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>but I want to make it work with link and href, because I want to make a client-side resource reference, not a server-side include.</p>
  
  <p>What it happens when the browser request the css file is this:
  <a href="https://i.stack.imgur.com/C45aa.png" rel="nofollow noreferrer">Firefox console screenshot</a></p>
  
  <p>I think that what happens is that when the browser request the <a href="http://localhost:8080/infinance/css/home.css" rel="nofollow noreferrer">http://localhost:8080/infinance/css/home.css</a>, the Tomcat returns the home.jsp. I don't know why.</p>
  
  <p>Home.java (servlet) code:</p>
  
  <pre><code>@WebServlet("/")
  public class Home extends HttpServlet {
      private static final long serialVersionUID = 1L;
        private static DatabaseManager db;
  
      public Home() {
          super();
      }
      public void init() {
          db = new DatabaseManager();
      }
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
           ServletContext sc = getServletContext();
           RequestDispatcher rd = sc.getRequestDispatcher("/home.jsp");
           rd.forward(request,response);
          }
  }
  </code></pre>
  
  <p>Any idea? Everything helps.
  Thanks.</p>