SpringMVC - 无法访问 index.jsp 中的 JS 和 CSS 文件

标签 spring spring-mvc tomcat servlets

我已经添加了

<mvc:resources mapping="/webapp/**" location="/webapp/" />
<mvc:default-servlet-handler />

在我的 dispatch-servlet.xml 中 我的文件夹层次结构是 enter image description here

并在 index.jsp 中声明

<spring:url value="/webapp/resources/js/bootstrap.min.js" var="bootstrapJS" />
<script src ="${bootstrapJS}"  type="text/javascript"></script>

谁能说出实际问题出在代码或文件夹层次结构上

最佳答案

您好,您是否在 index.jsp 的顶部包含了标签,它看起来像这样。 <%@ taglib prefix="spring"uri="http://www.springframework.org/tags"%>

关于SpringMVC - 无法访问 index.jsp 中的 JS 和 CSS 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40003568/

相关文章:

java - 在 tomcat 实例之间共享 session (不使用粘性 session )

spring - Apereo CAS 5.0.x Installation : No web. xml in the overlay

Spring 启动@Transactional

java - Hibernate - ManyToOne 和继承/JOINED/mappedBy

java - 使用 Spring Projection Interface 的 native 查询来选择字段

java - Spring4中需要xml bean的java表示

java - 为什么我的 "Set-Cookie"响应 header 没有被翻译成实际的 cookie?

java - Spring MVC Java多线程: perform an SQL statement in the background

Spring Boot 响应已提交资源请求异常

java - 从 web.xml 中的 session 超时中排除页面