Home > Web Front-end > CSS Tutorial > Reasons why jsp failed to load css

Reasons why jsp failed to load css

藏色散人
Release: 2021-02-04 17:38:15
Original
2850 people have browsed it

The reasons why jsp fails to load css: 1. The syntax of the css file is wrong; 2. The encoding of the css file is wrong; 3. The path to load the css file is wrong; 4. The filter is set; the solution: 1. Check css syntax; 2. Save the css file as UTF8 format; 3. Set the correct css path, etc.

Reasons why jsp failed to load css

The operating environment of this tutorial: windows7 system, css3&&jsp2.2 version, thinkpad t480 computer.

What are the reasons why jsp fails to load css?

Possible reasons are:

  • css file syntax error

  • css file encoding error

  • The path to load the css file is incorrect

  • Filter is set

Solution:

Method 1 : Check the css syntax and use online css code detection to check errors

Method 2: Use an editor that supports recoding and save the css file in UTF-8 format

Recommended: "css video tutorial

Method 3: Set the correct css path

(1) If your .jsp file is outside the WEB-INF folder, you can use a relative path

Reasons why jsp failed to load css

(2) If your .jsp file is in the WEB-INF folder, you must use the absolute path and add this ${pageContext.request.contextPath}

Reasons why jsp failed to load css

Method 4: Set the filter to intercept the request path to the corresponding file. For example, I filter jsp files, so my xml part is configured as follows:

<filter-mapping>
    <filter-name>login</filter-name>
     <url-pattern>/.jsp</url-pattern>
</filter-mapping>
Copy after login

For more technical articles related to CSS3, please visit the CSS3 Q&A column to learn!

The above is the detailed content of Reasons why jsp failed to load css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template