Skip to content
Snippets Groups Projects
Commit e38a9fee authored by Dave Syer's avatar Dave Syer
Browse files

Convert to jar with thymeleaf

parent 3450c3d9
No related branches found
No related tags found
No related merge requests found
Showing
with 52 additions and 591 deletions
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'vets')}">
<body>
<h2>Veterinarians</h2>
<table id="vets" class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Specialties</th>
</tr>
</thead>
<tbody>
<tr th:each="vet : ${vets.vetList}">
<td th:text="${vet.firstName + ' ' + vet.lastName}"></td>
<td><span th:each="specialty : ${vet.specialties}"
th:text="${specialty.name + ' '}" /> <span
th:if="${vet.nrOfSpecialties == 0}">none</span></td>
</tr>
</tbody>
</table>
<table class="table-buttons">
<tr>
<td><a th:href="@{/vets.html}">View
as XML</a></td>
<td><a th:href="@{/vets.json}">View as JSON</a></td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'home')}">
<body>
<h2 th:text="#{welcome}">Welcome</h2>
<div class="row">
<div class="col-md-12">
<img class="img-responsive" src="../static/resources/images/pets.png" th:src="@{/resources/images/pets.png}"/>
</div>
</div>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<!-- Fix Jetty 9 issue -->
<!-- http://stackoverflow.com/questions/32643530/classpath-issue-between-jetty-maven-plugin-and-tomcat-jdbc-8-0-9-leading-to-ser -->
<Set name="parentLoaderPriority">true</Set>
</Configure>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="error">
<spring:url value="/resources/images/pets.png" var="petsImage"/>
<img src="${petsImage}"/>
<h2>Something happened...</h2>
<p>${exception.message}</p>
</petclinic:layout>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="owners">
<h2>
<c:if test="${owner['new']}">New </c:if> Owner
</h2>
<form:form modelAttribute="owner" class="form-horizontal" id="add-owner-form">
<div class="form-group has-feedback">
<petclinic:inputField label="First Name" name="firstName"/>
<petclinic:inputField label="Last Name" name="lastName"/>
<petclinic:inputField label="Address" name="address"/>
<petclinic:inputField label="City" name="city"/>
<petclinic:inputField label="Telephone" name="telephone"/>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<c:choose>
<c:when test="${owner['new']}">
<button class="btn btn-default" type="submit">Add Owner</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit">Update Owner</button>
</c:otherwise>
</c:choose>
</div>
</div>
</form:form>
</petclinic:layout>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="owners">
<h2>Find Owners</h2>
<spring:url value="/owners.html" var="formUrl"/>
<form:form modelAttribute="owner" action="${fn:escapeXml(formUrl)}" method="get" class="form-horizontal"
id="search-owner-form">
<div class="form-group">
<div class="control-group" id="lastName">
<label class="col-sm-2 control-label">Last name </label>
<div class="col-sm-10">
<form:input class="form-control" path="lastName" size="30" maxlength="80"/>
<span class="help-inline"><form:errors path="*"/></span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Find Owner</button>
</div>
</div>
</form:form>
<br/>
<a class="btn btn-default" href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
</petclinic:layout>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="owners">
<h2>Owner Information</h2>
<table class="table table-striped">
<tr>
<th>Name</th>
<td><b><c:out value="${owner.firstName} ${owner.lastName}"/></b></td>
</tr>
<tr>
<th>Address</th>
<td><c:out value="${owner.address}"/></td>
</tr>
<tr>
<th>City</th>
<td><c:out value="${owner.city}"/></td>
</tr>
<tr>
<th>Telephone</th>
<td><c:out value="${owner.telephone}"/></td>
</tr>
</table>
<spring:url value="{ownerId}/edit.html" var="editUrl">
<spring:param name="ownerId" value="${owner.id}"/>
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Edit Owner</a>
<spring:url value="{ownerId}/pets/new.html" var="addUrl">
<spring:param name="ownerId" value="${owner.id}"/>
</spring:url>
<a href="${fn:escapeXml(addUrl)}" class="btn btn-default">Add New Pet</a>
<br/>
<br/>
<br/>
<h2>Pets and Visits</h2>
<table class="table table-striped">
<c:forEach var="pet" items="${owner.pets}">
<tr>
<td valign="top">
<dl class="dl-horizontal">
<dt>Name</dt>
<dd><c:out value="${pet.name}"/></dd>
<dt>Birth Date</dt>
<dd><fmt:formatDate value="${pet.birthDate}" pattern="yyyy-MM-dd"/></dd>
<dt>Type</dt>
<dd><c:out value="${pet.type.name}"/></dd>
</dl>
</td>
<td valign="top">
<table class="table-condensed">
<thead>
<tr>
<th>Visit Date</th>
<th>Description</th>
</tr>
</thead>
<c:forEach var="visit" items="${pet.visits}">
<tr>
<td><fmt:formatDate value="${visit.date}" pattern="yyyy-MM-dd"/></td>
<td><c:out value="${visit.description}"/></td>
</tr>
</c:forEach>
<tr>
<td>
<spring:url value="/owners/{ownerId}/pets/{petId}/edit" var="petUrl">
<spring:param name="ownerId" value="${owner.id}"/>
<spring:param name="petId" value="${pet.id}"/>
</spring:url>
<a href="${fn:escapeXml(petUrl)}">Edit Pet</a>
</td>
<td>
<spring:url value="/owners/{ownerId}/pets/{petId}/visits/new" var="visitUrl">
<spring:param name="ownerId" value="${owner.id}"/>
<spring:param name="petId" value="${pet.id}"/>
</spring:url>
<a href="${fn:escapeXml(visitUrl)}">Add Visit</a>
</td>
</tr>
</table>
</td>
</tr>
</c:forEach>
</table>
</petclinic:layout>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="owners">
<h2>Owners</h2>
<table id="vets" class="table table-striped">
<thead>
<tr>
<th style="width: 150px;">Name</th>
<th style="width: 200px;">Address</th>
<th>City</th>
<th style="width: 120px">Telephone</th>
<th>Pets</th>
</tr>
</thead>
<tbody>
<c:forEach items="${selections}" var="owner">
<tr>
<td>
<spring:url value="/owners/{ownerId}.html" var="ownerUrl">
<spring:param name="ownerId" value="${owner.id}"/>
</spring:url>
<a href="${fn:escapeXml(ownerUrl)}"><c:out value="${owner.firstName} ${owner.lastName}"/></a>
</td>
<td>
<c:out value="${owner.address}"/>
</td>
<td>
<c:out value="${owner.city}"/>
</td>
<td>
<c:out value="${owner.telephone}"/>
</td>
<td>
<c:forEach var="pet" items="${owner.pets}">
<c:out value="${pet.name} "/>
</c:forEach>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</petclinic:layout>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="owners">
<jsp:attribute name="customScript">
<script>
$(function () {
$("#birthDate").datepicker({dateFormat: 'yy/mm/dd'});
});
</script>
</jsp:attribute>
<jsp:body>
<h2>
<c:if test="${pet['new']}">New </c:if> Pet
</h2>
<form:form modelAttribute="pet"
class="form-horizontal">
<input type="hidden" name="id" value="${pet.id}"/>
<div class="form-group has-feedback">
<div class="form-group">
<label class="col-sm-2 control-label">Owner</label>
<div class="col-sm-10">
<c:out value="${pet.owner.firstName} ${pet.owner.lastName}"/>
</div>
</div>
<petclinic:inputField label="Name" name="name"/>
<petclinic:inputField label="Birth Date" name="birthDate"/>
<div class="control-group">
<petclinic:selectField name="type" label="Type " names="${types}" size="5"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<c:choose>
<c:when test="${pet['new']}">
<button class="btn btn-default" type="submit">Add Pet</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit">Update Pet</button>
</c:otherwise>
</c:choose>
</div>
</div>
</form:form>
<c:if test="${!pet['new']}">
</c:if>
</jsp:body>
</petclinic:layout>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="owners">
<jsp:attribute name="customScript">
<script>
$(function () {
$("#date").datepicker({dateFormat: 'yy/mm/dd'});
});
</script>
</jsp:attribute>
<jsp:body>
<h2><c:if test="${visit['new']}">New </c:if>Visit</h2>
<b>Pet</b>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Birth Date</th>
<th>Type</th>
<th>Owner</th>
</tr>
</thead>
<tr>
<td><c:out value="${visit.pet.name}"/></td>
<td><fmt:formatDate value="${visit.pet.birthDate}" pattern="yyyy/MM/dd"/></td>
<td><c:out value="${visit.pet.type.name}"/></td>
<td><c:out value="${visit.pet.owner.firstName} ${visit.pet.owner.lastName}"/></td>
</tr>
</table>
<form:form modelAttribute="visit" class="form-horizontal">
<div class="form-group has-feedback">
<petclinic:inputField label="Date" name="date"/>
<petclinic:inputField label="Description" name="description"/>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="petId" value="${visit.pet.id}"/>
<button class="btn btn-default" type="submit">Add Visit</button>
</div>
</div>
</form:form>
<br/>
<b>Previous Visits</b>
<table class="table table-striped">
<tr>
<th>Date</th>
<th>Description</th>
</tr>
<c:forEach var="visit" items="${visit.pet.visits}">
<c:if test="${!visit['new']}">
<tr>
<td><fmt:formatDate value="${visit.date}" pattern="yyyy/MM/dd"/></td>
<td><c:out value="${visit.description}"/></td>
</tr>
</c:if>
</c:forEach>
</table>
</jsp:body>
</petclinic:layout>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="vets">
<h2>Veterinarians</h2>
<table id="vets" class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Specialties</th>
</tr>
</thead>
<tbody>
<c:forEach items="${vets.vetList}" var="vet">
<tr>
<td>
<c:out value="${vet.firstName} ${vet.lastName}"/>
</td>
<td>
<c:forEach var="specialty" items="${vet.specialties}">
<c:out value="${specialty.name} "/>
</c:forEach>
<c:if test="${vet.nrOfSpecialties == 0}">none</c:if>
</td>
</tr>
</c:forEach>
</tbody>
</table>
<table class="table-buttons">
<tr>
<td>
<a href="<spring:url value="/vets.xml" htmlEscape="true" />">View as XML</a>
</td>
<td>
<a href="<spring:url value="/vets.json" htmlEscape="true" />">View as JSON</a>
</td>
</tr>
</table>
</petclinic:layout>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="home">
<h2><fmt:message key="welcome"/></h2>
<div class="row">
<div class="col-md-12">
<spring:url value="/resources/images/pets.png" htmlEscape="true" var="petsImage"/>
<img class="img-responsive" src="${petsImage}"/>
</div>
</div>
</petclinic:layout>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<%@ attribute name="menuName" required="true" rtexprvalue="true"
description="Name of the active menu: home, owners, vets or error" %>
<petclinic:menu name="${menuName}"/>
<%@ tag trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%-- Placed at the end of the document so the pages load faster --%>
<spring:url value="/webjars/jquery/2.2.4/jquery.min.js" var="jQuery"/>
<script src="${jQuery}"></script>
<%-- jquery-ui.js file is really big so we only load what we need instead of loading everything --%>
<spring:url value="/webjars/jquery-ui/1.11.4/jquery-ui.min.js" var="jQueryUiCore"/>
<script src="${jQueryUiCore}"></script>
<%-- Bootstrap --%>
<spring:url value="/webjars/bootstrap/3.3.6/js/bootstrap.min.js" var="bootstrapJs"/>
<script src="${bootstrapJs}"></script>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%--
PetClinic :: a Spring Framework demonstration
--%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags --%>
<spring:url value="/resources/images/favicon.png" var="favicon"/>
<link rel="shortcut icon" type="image/x-icon" href="${favicon}">
<title>PetClinic :: a Spring Framework demonstration</title>
<%-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --%>
<!--[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]-->
<spring:url value="/resources/generated/petclinic.css" var="petClinicCss"/>
<link href="${petClinicCss}" rel="stylesheet"/>
<spring:url value="/webjars/jquery-ui/1.11.4/jquery-ui.min.css" var="jQueryUiCss"/>
<link href="${jQueryUiCss}" rel="stylesheet"/>
<spring:url value="/resources/css/jquery-ui.theme.min.css" var="jQueryUiThemeCss"/>
<link href="${jQueryUiThemeCss}" rel="stylesheet"/>
</head>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ attribute name="name" required="true" rtexprvalue="true"
description="Name of corresponding property in bean object" %>
<%@ attribute name="label" required="true" rtexprvalue="true"
description="Label appears in red color if input is considered as invalid after submission" %>
<spring:bind path="${name}">
<c:set var="cssGroup" value="form-group ${status.error ? 'has-error' : '' }"/>
<c:set var="valid" value="${not status.error and not empty status.actualValue}"/>
<div class="${cssGroup}">
<label class="col-sm-2 control-label">${label}</label>
<div class="col-sm-10">
<form:input class="form-control" path="${name}"/>
<c:if test="${valid}">
<span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
</c:if>
<c:if test="${status.error}">
<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
<span class="help-inline">${status.errorMessage}</span>
</c:if>
</div>
</div>
</spring:bind>
<%@ tag trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<%@ attribute name="pageName" required="true" %>
<%@ attribute name="customScript" required="false" fragment="true"%>
<!doctype html>
<html>
<petclinic:htmlHeader/>
<body>
<petclinic:bodyHeader menuName="${pageName}"/>
<div class="container-fluid">
<div class="container xd-container">
<jsp:doBody/>
<petclinic:pivotal/>
</div>
</div>
<petclinic:footer/>
<jsp:invoke fragment="customScript" />
</body>
</html>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<%@ attribute name="name" required="true" rtexprvalue="true"
description="Name of the active menu: home, owners, vets or error" %>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="<spring:url value="/" htmlEscape="true" />"><span></span></a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar">
<span class="sr-only"><os-p>Toggle navigation</os-p></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="main-navbar">
<ul class="nav navbar-nav navbar-right">
<petclinic:menuItem active="${name eq 'home'}" url="/" title="home page">
<span class="glyphicon glyphicon-home" aria-hidden="true"></span>
<span>Home</span>
</petclinic:menuItem>
<petclinic:menuItem active="${name eq 'owners'}" url="/owners/find.html" title="find owners">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
<span>Find owners</span>
</petclinic:menuItem>
<petclinic:menuItem active="${name eq 'vets'}" url="/vets.html" title="veterinarians">
<span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
<span>Veterinarians</span>
</petclinic:menuItem>
<petclinic:menuItem active="${name eq 'error'}" url="/oups.html"
title="trigger a RuntimeException to see how it is handled">
<span class="glyphicon glyphicon-warning-sign" aria-hidden="true"></span>
<span>Error</span>
</petclinic:menuItem>
</ul>
</div>
</div>
</nav>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ attribute name="active" required="true" rtexprvalue="true" %>
<%@ attribute name="url" required="true" rtexprvalue="true" %>
<%@ attribute name="title" required="false" rtexprvalue="true" %>
<li class="${active ? 'active' : ''}">
<a href="<spring:url value="${url}" htmlEscape="true" />"
title="${fn:escapeXml(title)}">
<jsp:doBody/>
</a>
</li>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<br/>
<br/>
<div class="container">
<div class="row">
<div class="col-12 text-center"><img src="<spring:url value="/resources/images/spring-pivotal-logo.png" htmlEscape="true" />"
alt="Sponsored by Pivotal"/></div>
</div>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment