Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在将Java和Spring与thymeleaf一起使用时,如何包含css文件?_Java_Css_Spring_Thymeleaf - Fatal编程技术网

在将Java和Spring与thymeleaf一起使用时,如何包含css文件?

在将Java和Spring与thymeleaf一起使用时,如何包含css文件?,java,css,spring,thymeleaf,Java,Css,Spring,Thymeleaf,我试过不同的方法。对我来说,最符合逻辑的是标准方式,正如我现在在我的Item.html中所看到的: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"> <head> <title th:text="${item.name}"></title> <link href="styles.css" rel="stylesheet

我试过不同的方法。对我来说,最符合逻辑的是标准方式,正如我现在在我的Item.html中所看到的:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <title th:text="${item.name}"></title>
    <link href="styles.css" rel="stylesheet" type="text/css"/>
</head>
这就是netbeans中拖放给我的路径形式

我的文件结构如下所示:

有什么想法吗

在src/main/resources/文件夹中创建一个静态目录。 在已创建的静态文件夹中创建一个目录css以存储css文件。 将css文件放入css文件夹。 在html中,您可以包括css,如 这里的静态文件夹提供静态内容,如css、js文件