0

I have the following project structure.

Project Structure
transport-servlet.xml

<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:annotation-driven />
<mvc:default-servlet-handler />

My jsp-page:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/style.css"/>">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <div class="header">
            <ul>
                <li><a href="index">Главная</a></li>
                <li><a href="transportTask">Решение задачи транспортного типа</a></li>
                <li style="float:right"><a class="active" href="about">Об авторе</a></li>
            </ul>
        </div>
        <br><br>
    </body>
</html>

Can anybody help me please?
I don't know, why my css file is not loading.
Thank you in advance.

1

1 Answer 1

1

I solved my problem by adding this lines in my web.xml:

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.css</url-pattern>
</servlet-mapping>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.