title: How to use html and/or css styles in NetBeans servlet/jsp project?
body: <p>I tried to create simple servlet project using NetBeans and I've started with login. Login page was done in html and it is stored same as css documment in NetBeans "Web pages" floder (web in directory structure).</p>
  
  <p><img src="https://i.stack.imgur.com/5MG1f.png" alt="Way of storing files in NetBeans"></p>
  
  <p>If I try it to view page, all works fine with css included. However if I try to run this file ( shift + F6 ), there is error in browser that says something about fail of redirecting.
  <img src="https://i.stack.imgur.com/tUpGN.png" alt="Error during opening html page"></p>
  
  <p>Similar fail is there, if I try to use css file in jsp page. Although I have all html text in jsp page fine and it works if I use plain html page, in jsp page css doesn't work.
  To solve this problem I tried to use two servers, Glassfish and Apache Tomcat, both are not working. I've just also tried to check several topics that are similar, but description for including css to jsp wasn't working.
  Next task, that I have there is redirection by response.sendRedirect() function to login page. If I try to redirect to jsp page, it works fine (without css included), but if I try to redirect to html, it doesn't works with same error as is shown above. Same fail happens with not valid address stored as sendRedirect() function parameter.
  According some answers of this server I have stored html and css file in correct path (please consider the first image in this question).</p>
  
  <p><a href="https://stackoverflow.com/questions/5752246/problem-with-using-css-in-a-jsp-file-of-dynamic-web-project">Referencing a resource placed in WEB-INF folder in JSP file returns HTTP 404 on resource</a></p>
  
  <p>I think, that web servers simply doesn't know apropriate address for the web page and the css file. Is there some way to add it to web.xml or somewhere else to view the html page? If there is some another failure, how can I fix it? How can I add some external css file to jsp page?</p>
  
  <p>Great thanks for reply!</p>
  
  <p>After ArtyMcFly response added:
  Thanks for reply. I tried all that you described in your answer. my web.xml looks like that now:                                                            </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt;
  
   //This is changed code from MartyMcFly   
      &lt;servlet&gt;
      &lt;servlet-name&gt;errorPage&lt;/servlet-name&gt;
      &lt;jsp-file&gt;/WEB-INF/errorPage.jsp&lt;/jsp-file&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;errorPage&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/errorPage&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;TestServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;Controler.TestServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;TestServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/TestServlet&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;
              30
          &lt;/session-timeout&gt;
      &lt;/session-config&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>and I also changed link in servlet. to </p>
  
  <pre><code>&lt;link rel="stylesheet" type="text/css" href="./css/main.css" /&gt;
  </code></pre>
  
  <p>My css file is stored under Web Pages/css/main.css now.
  but there is nothing works.</p>
  
  <p>I cannot add screenshots until i will have 10 points. This is some server policy...</p>
  
  <p>PS: Because I have now over 10 points, I've just added some print screen explaining situation.</p>