【发布时间】:2015-02-24 23:49:19
【问题描述】:
我的动态 Web 项目有问题。
树状是
网页内容
|
|
引导
CSS
js
WEB-INF
|
|
连接.jsp
然后在 connection.jsp 我做这个:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-theme.css"/>
<link rel="stylesheet" type="text/css" href="css/connection.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/register.js"> </script>
<title>Jweb</title>
</head>
<body>
所有 css 都不适用,在 chrome 上的控制台中我有这个:
Resource interpreted as Stylesheet but transferred with MIME type text/html:
"http://localhost:8080/jweb/bootstrap/css/bootstrap-theme.css". localhost/:10
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/jweb/bootstrap/css/bootstrap.css". localhost/:9
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/jweb/css/footer.css". localhost/:11
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/jweb/css/header.css". localhost/:12
Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:8080/jweb/js/jquery.js". localhost/:14
Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:8080/jweb/js/bootstrap.js". localhost/:15
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/jweb/css/connection.css".
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<include-prelude>/WEB-INF/taglibs.jsp</include-prelude>
</jsp-property-group>
</jsp-config>
</web-app>
我在 2 天前尝试解决此问题,但我仍在解决此问题。 你能帮我解决吗?
【问题讨论】:
-
好的,但我不知道我必须在哪里设置这个?我尝试添加 并将内容类型设置为“text/css”但不工作。我试图将内容类型属性设置到我的 servlet 中。和其他一些解决方法(在互联网上找到的所有解决方案)但没有人工作
-
请参阅您的 Web 服务器文档。这取决于服务器软件。
-
告诉我们您的服务器类型(tomcat、glassfish、jboss)并发布您的 web.xml
-
@JérômeCampeaux 我的意思是把它贴在你的问题上......而不是作为答案。
-
对不起,我把它放在我的问题上
标签: java css jakarta-ee include mime