1


I do have a problem with applying css file into my jsp. When I run my project, I can see that the css are loaded when I inspect my page on the browser (Network -> 200 : OK). But I can't see any thing witch are applied according to the css instructions on my index.jsp
Thanks in advance.

1- index.jsp :

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>adding d'un client</title>
        <link type="text/css" rel="stylesheet" href="css/general.css" />
    </head>
    <body>
        <div>
            <form method="get" action="creationClient">
                <fieldset>
                    <legend>Informations of client</legend>

                    <label for="nClient">name <span class="requis">*</span></label>
                    <input type="text" id="nClient" name="nClient" value="" size="20" maxlength="20" />
                    <br />
                </fieldset>
                <input type="submit" value="add"  />

            </form>
        </div>
    </body>
</html>

2- general.css

body, p, legend, label, input {
    font: normal 8pt verdana, helvetica, sans-serif;
    color:red;
}


fieldset {
    padding: 100px;
    border: 1px #111 solid;
    margin: 10px;
}

legend {
    font-weight: bold;
    color: #0568CD;
}

form label {
    float: left;
    width: 200px;
    margin: 3px 0px 0px 0px;
}

form input {
    margin: 3px 3px 0px 0px;
    border: 1px #999 solid;
}

form input.sansLabel {
    margin-left: 200px;
}


.requis {
    color: #c00;
}

.erreur {
    color: #900;
}

.succes {
    color: #090;
}

.info {
    font-style: italic;
    color: #E8A22B;
}

3- Struct of project:
|--->Project1
    |--->css
        |--->general.css
    |--->META-INF
    |--->WEB-INF
        |--->index.jsp
        |--->web.xml

Network inspecting.png
Many Thanks.

UPDATE 1

3- Struct of project:
|--->WebContent
    |--->css
        |--->general.css
    |--->META-INF
    |--->WEB-INF
        |--->index.jsp
        |--->web.xml

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • If you are working on Eclipse, the standard structure generated should be: yourproject/WebContent/WEB-INF and yourproject/WebContent/META-INF. At the same level, your static content should be placed. Have you tried using ? – Marcelo Tataje Nov 22 '17 at 13:36
  • Does the web browser see the same version of the CSS? In the web browser, right-click and choose _View page source_, click the link to the CSS file and hit F5 for a refresh. – howlger Nov 22 '17 at 13:38
  • Hello Marcelo Tataje, thanks for your response. I agree with you about the structure of my prject and effectively I mad a mistake when I write the question. The question was updated. About using "${pageContext.request.contextPath}", it gives the same result. – stro strong Nov 22 '17 at 13:45
  • Thank you Howlger for your response, following your steps, when I click on the link of the CSS file, I redirected to the same page which is index.jsp (in HTML format). – stro strong Nov 22 '17 at 13:52

0 Answers0