我想將我在eclipse中創建的css鏈接到jsp,並且當我運行該項目時,我在瀏覽器中得不到任何結果。我已經嘗試了多種方式,通過投入將eclipse中內置的CSS鏈接到jsp並獲取結果
<link rel="stylesheet" href="css/first.css" type="text/css">
<link rel="stylesheet" href="boe/WebContent/first.css" type="text/css">
<link rel="stylesheet" href="(my full path to the file)" type="text/css">
我已經試過這麼多,我不記得我是如何得到它沒有錯誤。我得到這個
Tag (link) should be an empty-element tag.
作爲警告錯誤。
我無法找到任何步驟創建css並使其鏈接到jsp,所以它可以顯示在我的瀏覽器。
這裏是我的代碼爲jsp和css。
的jsp:
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page import="java.util.*" language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="css/first.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>TestPage - Test1</title>
</head>
<body>
<div id="page-container">Hello World</div>
<%Date d = new Date(session.getLastAccessedTime());%>
this page was last viewed <%= d.toString() %>
</body>
</html>
CSS:
@CHARSET "UTF-8";
html, body {
margin:0;
padding:0;
}
#page-container {
width: 760px;
margin: auto;
background: red;
}
上發現一步步或者如果你有一個很好的解釋,這將是非常讚賞的任何幫助。謝謝
謝謝你。它將錯誤消除了,但仍然沒有得到css實現的結果。 –