使用springboot,intellij,maven,tomcat-embed-jasper创建一个Web应用程序。我想渲染放置在要在网站中渲染的项目中的图像。下面是我的代码。
@SpringBootApplication
public class EproApplication {
public static void main(String[] args) {
SpringApplication.run(EproApplication.class, args);
}
}
welcome.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<link href="webjars/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet">
<script src="webjars/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script src="webjars/jquery/3.3.1-1/jquery.min.js"></script>
<%@ include file="/WEB-INF/views/js/welcomejs.jsp" %>
<%@ include file="/WEB-INF/views/css/welcomecss.jsp" %>
<title>Title</title>
</head>
<body>
<img src="../../WEB-INF/views/images/download.jpg" alt="Smiley face" >
<img src="../views/images/download.jpg" alt="Smiley face" >
<img src="../resources/images/download.jpg" alt="Smiley face" >
<button class="width100 height50 w-100">Bootstrap test</button>
</body>
</html>