我有一些問題訪問我的CSS文件。我搜索了,但我無法弄清楚什麼是不正確的。無法訪問我的CSS我的CSS文件
的web.xml:
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.mvc</url-pattern>
</servlet-mapping>
我的JSP:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Portail web </title>
<link rel="stylesheet" type="text/css"
href="../GN/css/portail.css" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<h1>TEST</h1>
</body>
<html>
我的CSS:
@CHARSET "ISO-8859-1";
body
{
background-color:blue;
}
我的架構:
JSP爲:webapp/WEB-INF/FR/JSP/portail.jsp
CSS是:webapp/WEB-INF/GN/css/portail.css
我想絕對路徑過,但沒有工作(不加我的JSP的風格)。
謝謝。
編輯:
如果我做<%@ include file="/WEB-INF/GN/css/portail.css"%>
它打印出我的CSS,因此該路徑是好的,但風格並不適用於我的jsp:/
是的,對不起,這是進行測試,這是../../GN,但它不工作也沒有。我用我的控制器訪問我的jsp @RequestMapping(「/ portail.mvc」)? – MinionKing
你用'GN/css/portail.css'試過了嗎?如果您的映射路徑位於您的web應用程序的根目錄下 – gma