JSP does not display images or find CSS and Javascript

Asked

Viewed 255 times

0

Good night,

I’m having a weird problem, I’m trying to display images, map CSS and JS in jsp and it’s not working, it just doesn’t, the weirdest thing is that I’m using the c:url tag of "jstl/core" and I tried to use ${pageContext.request.contextPath} and it didn’t work.

I am using simple Servlet without any framework.

estrutura

<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>clientes atuantes</title>
        <link rel="stylesheet" href="<c:url value="/bootstrap/css/bootstrap.min.css"/>">
        <link rel="stylesheet" href="<c:url value="/css/layout.css"/>">
        <script type="text/javascript" src="<c:url value="/bootstrap/js/jquery-1.12.0.js" />"></script>
        <script type="text/javascript" src="<c:url value="/bootstrap/js/bootstrap.min.js" />"></script>
    </head>
    <body>

        <main>
            <div class="col-md-12">
                <div class="panel panel-default espacamentoExterno5">

                    <div class="panel-body">
                        <p><img src="<c:url value="/img/ativo.gif"/>" /> ativo</p>
                        <p><img src="<c:url value="/img/congelado.gif"/>" /> congelado</p>
                        <p><img src="<c:url value="/img/cancelado.gif"/>" /> cancelado</p>

                    </div>
                </div>
            </div>
        </main>
    </body>

someone knows what might be going on?

  • Hello, welcome to [en.so]! Could you edit your question with the directory structure of your application? You may be putting the files in the wrong place.

  • It seems that you are not escaping the quotes. Try <img src="<c:url value=\""/img/designado1.gif\""/>"/>

  • put the structure

  • Try to put ../ level up in the folder. An example: <img src="<c:url value=".. /img/active.gif"/>" />

  • None of your options solved

  • @Bandoleiro has an error in the console? F12-> console. It also tries to take out the <c:url value= you don’t need. Another idea, try to put <img src=".. /.. /img/active.gif"/>" />

  • tb didn’t work

  • Guys, I have no idea what I can do to fix this

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.