我是新来的,所以希望能为您提供帮助:)
我是一个后端开发人员,但是这次我不得不与一个前端项目抗争,所以我在 Maven Web项目中使用 JSP和Servlets 第一次。 我没有使用javascript或其他框架,而没有使用JSP和Servlet。
尝试在浏览器中运行项目时出现以下错误:
资源解释为样式表,但以MIME类型传输 文本/纯文本:“ http://localhost:8081/hupaFIN/css/style.css”。
我试图更改Content-type,新的CSS文件...并且我一直在阅读相关主题,但是找不到解决方案。希望您能提供帮助:)
我在这里将我的文件:
我正在使用CSS文件的JSP:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- <meta http-equiv="Content-Type"
content="application/javascript; charset=ISO-8859-1"> -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Java Bean In Servlet 3.0</title>
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/css/estilos.css" />
</head>
<body>
<center>
<h2>Hospital Universitario</h2>
<h3>Proyecto desarrollado por José</h3>
<form action="${pageContext.request.contextPath}/myservlet"
method="post">
<input type="submit" name="button1" value="KMeans" /> <input
type="submit" name="button2" value="DTree" />
</form>
</center>
CSS文件
label {
color: grey;
display: block;
white-space: pre;
}
h1 {
color: blue
}
h3 {
color: blue
font-style: bold
}
如果需要其他文件或其他东西,请告诉我!
非常感谢大家:)!