Java Spring没有看到css文件
Java Spring没有看到css文件,java,spring-mvc,spring-security,Java,Spring Mvc,Spring Security,安全上下文: <intercept-url pattern="/resources/**" access="permitAll" /> Spring上下文: <mvc:resources location="/resources/" mapping="/resources/**" /> 在jsp中导入css文件: <link rel="stylesheet" type="text/css" href="<c:url value="/resource
安全上下文:
<intercept-url pattern="/resources/**" access="permitAll" />
Spring上下文:
<mvc:resources location="/resources/" mapping="/resources/**" />
在jsp中导入css文件:
<link rel="stylesheet" type="text/css" href="<c:url value="/resources/style.css" />">
我不知道怎么了。。。提前感谢您的回答。只需在
.jsp
中执行以下操作即可(无/
在参考资料之前)
去掉c:url
的东西,然后像href=“/resources/style.css”/>首先,在添加到html之前,您应该检查url中的文件css。第二个。我有一个问题要问你,为什么在linkimportcss文件中,你使用href=“”
而不是href=“resources/style.css”/“
在spring上下文中,我希望您将文件css保存在文件夹中:src/main/webapp/resources/cssfile.css
不在src/main/resources
您可以这样尝试吗:如图所示,为什么资源在第二个示例中出现两次?@Wojkek:它记录了什么?@Wojtek似乎Spring Security仍然将您的css文件视为正常请求。您能提供您的配置吗。@nguyentaijs@Wojtek的请求路径是:filmApp.Test.Test()
<link href="resources/style.css"" rel="stylesheet"/>
<link href="<c:url value='resources/style.css' />" rel="stylesheet" />
<link href="${pageContext.request.contextPath}/resources/style.css" rel="stylesheet" />