在使用Spring和Apache FreeMarker时访问CSS路径出现问题。

huangapple go评论86阅读模式
英文:

Problem with paths accessing CSS with Spring and Apache FreeMarker

问题

我在尝试从较低的目录访问静态CSS资源时遇到了问题。如果我在主目录中,它可以检测到一切,但如果我进入其他较低的目录,它会添加从那个文件夹的路径,并且无法检测到它们。

错误
(在该路径中,“server”是不应出现的目录,因为css位于主目录中)

    <link rel="stylesheet" href="/css/bootstrap.min.css">
<!-- Bootstrap CSS
	============================================ -->
<link rel="stylesheet" href="/css/font-awesome.min.css">

我尝试过使用../、./等方式,搜索了互联网,但没有找到任何有用的信息。

我正在使用Apache FreeMarker。

英文:

I'm having a problem trying to access my static CSS resources from lower directories. If I am in the main directory it detects everything but if I go to other lower directories, it adds the path from that folder and does not detect them.

Error
(In that path "server" is a directory that should not appear, since css is in the main directory)

    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/bootstrap.min.css&quot;&gt;
&lt;!-- Bootstrap CSS
	============================================ --&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;/css/font-awesome.min.css&quot;&gt;

I tried from putting ../, ./ searching the internet but I didn't find anything.

I am using Apache FreeMarker

答案1

得分: 0

Use .. to indicate the parent directory:

<link rel="stylesheet" href="../css/bootstrap.min.css">

<link rel="stylesheet" href="../css/font-awesome.min.css">

This will help you.

英文:

Use .. to indicate the parent directory:

&lt;link rel=&quot;stylesheet&quot; href=&quot;../css/bootstrap.min.css&quot;&gt;

&lt;link rel=&quot;stylesheet&quot; href=&quot;../css/font-awesome.min.css&quot;&gt;

This will help you.

huangapple
  • 本文由 发表于 2020年8月28日 20:58:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/63634271.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定