Skip to content

Commit ccbc606

Browse files
committed
Use relative paths so index is unaffected by its context path
Previously, index.html used absolute paths to load its CSS and JavaScript. This meant that it had to be deployed to /. This commit updates the HTML to use relative paths for its CSS and JavaScript, thereby ensuring that they can be loaded irrespective of the context path to which the application is deployed. Closes gh-1988
1 parent 3bad634 commit ccbc606

File tree

1 file changed

+4
-4
lines changed
  • spring-boot-samples/spring-boot-sample-web-static/src/main/webapp

1 file changed

+4
-4
lines changed

spring-boot-samples/spring-boot-sample-web-static/src/main/webapp/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<title>Static</title>
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<link rel="stylesheet" type="text/css"
7-
href="/webjars/bootstrap/3.0.3/css/bootstrap.min.css" />
7+
href="webjars/bootstrap/3.0.3/css/bootstrap.min.css" />
88
</head>
99
<body>
1010
<script type="text/javascript"
11-
src="/webjars/jquery/2.0.3/jquery.min.js"></script>
11+
src="webjars/jquery/2.0.3/jquery.min.js"></script>
1212
<div id="navbar" class="navbar navbar-default" role="navigation">
1313
<div class="navbar-header">
1414
<button type="button" class="navbar-toggle" data-toggle="collapse"
@@ -22,7 +22,7 @@
2222
</div>
2323
<div class="navbar-collapse collapse">
2424
<ul class="nav navbar-nav">
25-
<li><a href="/"> Home </a></li>
25+
<li><a href="./"> Home </a></li>
2626
</ul>
2727
</div>
2828
</div>
@@ -34,6 +34,6 @@ <h1>Home</h1>
3434
</p>
3535
</div>
3636
<script type="text/javascript"
37-
src="/webjars/bootstrap/3.0.3/js/bootstrap.min.js"></script>
37+
src="webjars/bootstrap/3.0.3/js/bootstrap.min.js"></script>
3838
</body>
3939
</html>

0 commit comments

Comments
 (0)