我正在本地的Tomcat服务器上编写Web应用程序。我创建了一个名为index.jsp的主页,该主页的HTML布局使用了引导程序。当我运行服务器时,它看起来应该是应该的,但是当我使用servlet将任何属性重定向到index.jsp时,布局完全崩溃。 这是我的servlet:
@WebServlet(name = "HomeServ",urlPatterns = "/")
public class HomServ extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ArrayList<Solution> list = Solution.loadAllSolutions();
request.setAttribute("list",list);
getServletContext().getRequestDispatcher("/index.jsp").forward(request,response);
}
}
这是我的index.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="/CSS_BOOTSTRAP/boot/bootstrap.min.css" >
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body style="font-family: Bookman, dsTimes, serif; background-color: #558C89">
<nav class="navbar navbar-inverse" style="height: 25px" >
<div class="container-fluid">
<div class="navbar-header" style="border-right: 1px solid grey; border-right-width: thin;">
<a class="navbar-brand" href="index.html">Strona glowna</a>
</div>
<ul class="nav navbar-nav">
<li><a href="PodStrona/index.html" style="border-right: 1px solid grey">Grupy</a></li>
<li><a href="podstrona - kontakt/index.html" style="border-right: 1px solid grey">Kontakt</a></li>
</ul>
<img src="CSS_BOOTSTRAP/images/fsaf.png" style="margin-left: 515px;margin-top: 3px" >
<div style="float: right; margin-top: 0; margin-right: 17px; height: 49px">
<button type="button" class="btn btn-warning" data-toggle="modal" data-target="#exampleModal" style="border-radius: 0%; height: 49px">Administrator</button>
</div>
<<div style="float: right; margin-top: 0; margin-right: 17px; height: 49px">
<button type="button" class="btn btn-warning" data-toggle="modal" data-target="#exampleModal" style="border-radius: 0%; height: 49px">Zaloguj sie</button>
</div>
<div style="float: right; margin-top: 0; height: 27px; margin-right: 20px; margin-top: 10px">
<iframe src="http://free.timeanddate.com/clock/i6bku4wf/n262/fn5/fs22/fc808080/tct/th1" frameborder="0" width="100" height="25" allowTransparency="true" style="margin: auto;"></iframe>
</div>
</nav>
<table>
<c:forEach items="${list}" var="list">
<tr>
<td>${list.description}</td>
<td>${list.user_id}</td>
<td>${list.exercise_id}</td>
</tr>
</c:forEach>
</table>
<div style=" position: fixed; left: 0;bottom: 0; width: 100%; background-color: black; color: white; text-align: center;">
<p style="font-size: 15px"> Aplikacja webowa by Bruno Kędzierski | <a href="https://github.com/BrunoKedzierski">GitHub</a> </p>
</div>
</body>
</html>
如您所见,我的Bootstrap和所有资源(图像,字体)已添加到项目中,并且链接了项目中用于样式表(<link rel="stylesheet" href="/CSS_BOOTSTRAP/boot/bootstrap.min.css" >
)的文件夹。我确认这是它崩溃的原因,但我不确定。