Last active
January 12, 2016 23:46
-
-
Save teggr/eb882a18f0b18a4acd40 to your computer and use it in GitHub Desktop.
Spring boot web starter snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:th="http://www.thymeleaf.org"> | |
<head th:fragment="head (title)"> | |
<meta charset="utf-8"></meta> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"></meta> | |
<meta name="viewport" content="width=device-width, initial-scale=1"></meta> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<title th:text="${title}">Template Title</title> | |
<!-- Bootstrap --> | |
<link th:href="@{/webjars/bootstrap/3.3.6/css/bootstrap.min.css}" rel="stylesheet"></link> | |
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | |
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | |
<!--[if lt IE 9]> | |
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | |
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |
<![endif]--> | |
<style type="text/css"> | |
</style> | |
</head> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:th="http://www.thymeleaf.org"> | |
<body th:fragment="header (page)"> | |
<nav class="navbar navbar-default"> | |
<div class="container-fluid"> | |
<!-- Brand and toggle get grouped for better mobile display --> | |
<div class="navbar-header"> | |
<button type="button" class="navbar-toggle collapsed" | |
data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" | |
aria-expanded="false"> | |
<span class="sr-only">Toggle navigation</span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
</button> | |
<a class="navbar-brand" th:href="@{/}">WAGA</a> | |
</div> | |
<!-- Collect the nav links, forms, and other content for toggling --> | |
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | |
<ul class="nav navbar-nav"> | |
<li th:classappend="${page.equals('home')}? 'active'"><a th:href="@{/}"><span>Home</span></a></li> | |
<li th:if="${#httpServletRequest.remoteUser}"><form class="navbar-form" th:action="@{/logout}" method="post"><input class="btn btn-link nav-link" type="submit" value="Sign Out"/></form> </li> | |
</ul> | |
</div> | |
<!-- /.navbar-collapse --> | |
</div> | |
<!-- /.container-fluid --> | |
</nav> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"> | |
<head th:include="fragments/head::head (title='The Developer Daily :: Home')"></head> | |
<body> | |
<div th:replace="fragments/header::header (page='home')"></div> | |
<div class="container-fluid"> | |
<div class="row"> | |
<div class="col-md-12"> | |
</div> | |
</div> | |
</div> | |
<th:block th:include="fragments/scripts::scripts"></th:block> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping("/") | |
@Controller | |
public class HomeController { | |
@RequestMapping(method = RequestMethod.GET) | |
public String home(ModelMap map) { | |
return "home"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.webjars</groupId> | |
<artifactId>jquery</artifactId> | |
<version>2.1.4</version> | |
</dependency> | |
<dependency> | |
<groupId>org.webjars</groupId> | |
<artifactId>bootstrap</artifactId> | |
<version>3.3.6</version> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:th="http://www.thymeleaf.org"> | |
<body th:fragment="scripts"> | |
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> | |
<script th:src="@{/webjars/jquery/2.1.4/jquery.min.js}"></script> | |
<!-- Include all compiled plugins (below), or include individual files as needed --> | |
<script th:src="@{/webjars/bootstrap/3.3.6/js/bootstrap.min.js}"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment