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).
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.
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).
Referencing a resource placed in WEB-INF folder in JSP file returns HTTP 404 on resource
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?
Great thanks for reply!
After ArtyMcFly response added: Thanks for reply. I tried all that you described in your answer. my web.xml looks like that now:
<?xml version="1.0" encoding="UTF-8"?>
<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">
//This is changed code from MartyMcFly
<servlet>
<servlet-name>errorPage</servlet-name>
<jsp-file>/WEB-INF/errorPage.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>errorPage</servlet-name>
<url-pattern>/errorPage</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>Controler.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/TestServlet</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
and I also changed link in servlet. to
<link rel="stylesheet" type="text/css" href="./css/main.css" />
My css file is stored under Web Pages/css/main.css now. but there is nothing works.
I cannot add screenshots until i will have 10 points. This is some server policy...
PS: Because I have now over 10 points, I've just added some print screen explaining situation.