Skip to content
Snippets Groups Projects
Commit a2849f75 authored by Dapeng's avatar Dapeng Committed by Antoine Rey
Browse files

Simplify jsp layout management

abstract the page layout into “layout.tag”
parent 50f46fdd
No related branches found
No related tags found
No related merge requests found
Showing
with 287 additions and 410 deletions
<!DOCTYPE html> <%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ page session="false" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ 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" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<html lang="en"> <petclinic:layout pageName="error">
<jsp:include page="fragments/htmlHeader.jsp"/>
<body>
<petclinic:bodyHeader menuName="error"/>
<div class="container-fluid">
<div class="container xd-container">
<spring:url value="/resources/images/pets.png" var="petsImage"/>
<img src="${petsImage}"/>
<h2>Something happened...</h2> <spring:url value="/resources/images/pets.png" var="petsImage"/>
<img src="${petsImage}"/>
<p>${exception.message}</p> <h2>Something happened...</h2>
<!-- Exception: ${exception.message}. <p>${exception.message}</p>
<c:forEach items="${exception.stackTrace}" var="stackTrace">
${stackTrace}
</c:forEach>
-->
<petclinic:pivotal/>
</div>
</div>
<jsp:include page="fragments/footer.jsp"/>
</body>
</html> </petclinic:layout>
<!DOCTYPE html>
<%@ page session="false" %> <%@ page session="false" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
...@@ -8,43 +6,29 @@ ...@@ -8,43 +6,29 @@
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="owners">
<html lang="en"> <h2>
<c:if test="${owner['new']}">New </c:if> Owner
<jsp:include page="../fragments/htmlHeader.jsp"/> </h2>
<form:form modelAttribute="owner" class="form-horizontal" id="add-owner-form">
<body> <div class="form-group has-feedback">
<petclinic:bodyHeader menuName="owners"/> <petclinic:inputField label="First Name" name="firstName"/>
<div class="container-fluid"> <petclinic:inputField label="Last Name" name="lastName"/>
<div class="container xd-container"> <petclinic:inputField label="Address" name="address"/>
<h2> <petclinic:inputField label="City" name="city"/>
<c:if test="${owner['new']}">New </c:if> Owner <petclinic:inputField label="Telephone" name="telephone"/>
</h2> </div>
<form:form modelAttribute="owner" class="form-horizontal" id="add-owner-form"> <div class="form-group">
<div class="form-group has-feedback"> <div class="col-sm-offset-2 col-sm-10">
<petclinic:inputField label="First Name" name="firstName"/> <c:choose>
<petclinic:inputField label="Last Name" name="lastName"/> <c:when test="${owner['new']}">
<petclinic:inputField label="Address" name="address"/> <button class="btn btn-default" type="submit">Add Owner</button>
<petclinic:inputField label="City" name="city"/> </c:when>
<petclinic:inputField label="Telephone" name="telephone"/> <c:otherwise>
</div> <button class="btn btn-default" type="submit">Update Owner</button>
<div class="form-group"> </c:otherwise>
<div class="col-sm-offset-2 col-sm-10"> </c:choose>
<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> </div>
</form:form> </div>
<petclinic:pivotal/> </form:form>
</div> </petclinic:layout>
</div>
<jsp:include page="../fragments/footer.jsp"/>
</body>
</html>
<!DOCTYPE html>
<%@ page session="false" %> <%@ page session="false" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
...@@ -7,45 +5,30 @@ ...@@ -7,45 +5,30 @@
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<html lang="en"> <petclinic:layout pageName="owners">
<jsp:include page="../fragments/htmlHeader.jsp"/>
<body> <h2>Find Owners</h2>
<petclinic:bodyHeader menuName="owners"/>
<div class="container-fluid">
<div class="container xd-container">
<h2>Find Owners</h2> <spring:url value="/owners.html" var="formUrl"/>
<form:form modelAttribute="owner" action="${fn:escapeXml(formUrl)}" method="get" class="form-horizontal"
<spring:url value="/owners.html" var="formUrl"/> id="search-owner-form">
<form:form modelAttribute="owner" action="${fn:escapeXml(formUrl)}" method="get" class="form-horizontal" <div class="form-group">
id="search-owner-form"> <div class="control-group" id="lastName">
<div class="form-group"> <label class="col-sm-2 control-label">Last name </label>
<div class="control-group" id="lastName"> <div class="col-sm-10">
<label class="col-sm-2 control-label">Last name </label> <form:input class="form-control" path="lastName" size="30" maxlength="80"/>
<div class="col-sm-10"> <span class="help-inline"><form:errors path="*"/></span>
<form:input class="form-control" path="lastName" size="30" maxlength="80"/>
<span class="help-inline"><form:errors path="*"/></span>
</div>
</div> </div>
</div> </div>
<div class="form-group"> </div>
<div class="col-sm-offset-2 col-sm-10"> <div class="form-group">
<button type="submit" class="btn btn-default">Find Owner</button> <div class="col-sm-offset-2 col-sm-10">
</div> <button type="submit" class="btn btn-default">Find Owner</button>
</div> </div>
</div>
</form:form> </form:form>
<br/>
<a class="btn btn-default" href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
<petclinic:pivotal/>
</div>
</div>
<jsp:include page="../fragments/footer.jsp"/>
</body>
</html> <br/>
<a class="btn btn-default" href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
</petclinic:layout>
<!DOCTYPE html>
<%@ page session="false" %> <%@ page session="false" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
...@@ -8,109 +6,94 @@ ...@@ -8,109 +6,94 @@
<%@ taglib prefix="joda" uri="http://www.joda.org/joda/time/tags" %> <%@ taglib prefix="joda" uri="http://www.joda.org/joda/time/tags" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<html lang="en"> <petclinic:layout pageName="owners">
<jsp:include page="../fragments/htmlHeader.jsp"/> <h2>Owner Information</h2>
<body>
<petclinic:bodyHeader menuName="owners"/> <table class="table table-striped">
<div class="container-fluid"> <tr>
<div class="container xd-container"> <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}">
<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> <tr>
<th>City</th> <td valign="top">
<td><c:out value="${owner.city}"/></td> <dl class="dl-horizontal">
</tr> <dt>Name</dt>
<tr> <dd><c:out value="${pet.name}"/></dd>
<th>Telephone</th> <dt>Birth Date</dt>
<td><c:out value="${owner.telephone}"/></td> <dd><joda:format value="${pet.birthDate}" pattern="yyyy-MM-dd"/></dd>
</tr> <dt>Type</dt>
</table> <dd><c:out value="${pet.type.name}"/></dd>
</dl>
<spring:url value="{ownerId}/edit.html" var="editUrl"> </td>
<spring:param name="ownerId" value="${owner.id}"/> <td valign="top">
</spring:url> <table class="table-condensed">
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Edit Owner</a> <thead>
<tr>
<spring:url value="{ownerId}/pets/new.html" var="addUrl"> <th>Visit Date</th>
<spring:param name="ownerId" value="${owner.id}"/> <th>Description</th>
</spring:url> </tr>
<a href="${fn:escapeXml(addUrl)}" class="btn btn-default">Add New Pet</a> </thead>
<c:forEach var="visit" items="${pet.visits}">
<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><joda:format 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> <tr>
<th>Visit Date</th> <td><joda:format value="${visit.date}" pattern="yyyy-MM-dd"/></td>
<th>Description</th> <td><c:out value="${visit.description}"/></td>
</tr> </tr>
</thead> </c:forEach>
<c:forEach var="visit" items="${pet.visits}"> <tr>
<tr> <td>
<td><joda:format value="${visit.date}" pattern="yyyy-MM-dd"/></td> <spring:url value="/owners/{ownerId}/pets/{petId}/edit" var="petUrl">
<td><c:out value="${visit.description}"/></td> <spring:param name="ownerId" value="${owner.id}"/>
</tr> <spring:param name="petId" value="${pet.id}"/>
</c:forEach> </spring:url>
<tr> <a href="${fn:escapeXml(petUrl)}">Edit Pet</a>
<td> </td>
<spring:url value="/owners/{ownerId}/pets/{petId}/edit" var="petUrl"> <td>
<spring:param name="ownerId" value="${owner.id}"/> <spring:url value="/owners/{ownerId}/pets/{petId}/visits/new" var="visitUrl">
<spring:param name="petId" value="${pet.id}"/> <spring:param name="ownerId" value="${owner.id}"/>
</spring:url> <spring:param name="petId" value="${pet.id}"/>
<a href="${fn:escapeXml(petUrl)}">Edit Pet</a> </spring:url>
</td> <a href="${fn:escapeXml(visitUrl)}">Add Visit</a>
<td> </td>
<spring:url value="/owners/{ownerId}/pets/{petId}/visits/new" var="visitUrl"> </tr>
<spring:param name="ownerId" value="${owner.id}"/> </table>
<spring:param name="petId" value="${pet.id}"/> </td>
</spring:url> </tr>
<a href="${fn:escapeXml(visitUrl)}">Add Visit</a>
</td>
</tr>
</table>
</td>
</tr>
</c:forEach>
</table>
<petclinic:pivotal/>
</div>
</div>
<jsp:include page="../fragments/footer.jsp"/>
</body> </c:forEach>
</table>
</html> </petclinic:layout>
<!DOCTYPE html>
<%@ page session="false" %> <%@ page session="false" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
...@@ -8,43 +6,28 @@ ...@@ -8,43 +6,28 @@
<%@ taglib prefix="datatables" uri="http://github.com/dandelion/datatables" %> <%@ taglib prefix="datatables" uri="http://github.com/dandelion/datatables" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<html lang="en"> <petclinic:layout pageName="owners">
<h2>Owners</h2>
<jsp:include page="../fragments/htmlHeader.jsp"/>
<datatables:table id="owners" data="${selections}" row="owner"
<body> cssClass="table table-striped" pageable="false" info="false" export="pdf">
<petclinic:bodyHeader menuName="owners"/> <datatables:column title="Name" cssStyle="width: 150px;" display="html">
<div class="container-fluid"> <spring:url value="/owners/{ownerId}.html" var="ownerUrl">
<div class="container xd-container"> <spring:param name="ownerId" value="${owner.id}"/>
<h2>Owners</h2> </spring:url>
<a href="${fn:escapeXml(ownerUrl)}"><c:out value="${owner.firstName} ${owner.lastName}"/></a>
<datatables:table id="owners" data="${selections}" row="owner" </datatables:column>
cssClass="table table-striped" pageable="false" info="false" export="pdf"> <datatables:column title="Name" display="pdf">
<datatables:column title="Name" cssStyle="width: 150px;" display="html"> <c:out value="${owner.firstName} ${owner.lastName}"/>
<spring:url value="/owners/{ownerId}.html" var="ownerUrl"> </datatables:column>
<spring:param name="ownerId" value="${owner.id}"/> <datatables:column title="Address" property="address" cssStyle="width: 200px;"/>
</spring:url> <datatables:column title="City" property="city"/>
<a href="${fn:escapeXml(ownerUrl)}"><c:out value="${owner.firstName} ${owner.lastName}"/></a> <datatables:column title="Telephone" property="telephone"/>
</datatables:column> <datatables:column title="Pets" cssStyle="width: 100px;">
<datatables:column title="Name" display="pdf"> <c:forEach var="pet" items="${owner.pets}">
<c:out value="${owner.firstName} ${owner.lastName}"/> <c:out value="${pet.name}"/>
</datatables:column> </c:forEach>
<datatables:column title="Address" property="address" cssStyle="width: 200px;"/> </datatables:column>
<datatables:column title="City" property="city"/> <datatables:export type="pdf" cssClass="btn" cssStyle="height: 25px;"/>
<datatables:column title="Telephone" property="telephone"/> </datatables:table>
<datatables:column title="Pets" cssStyle="width: 100px;"> </petclinic:layout>
<c:forEach var="pet" items="${owner.pets}">
<c:out value="${pet.name}"/>
</c:forEach>
</datatables:column>
<datatables:export type="pdf" cssClass="btn" cssStyle="height: 25px;"/>
</datatables:table>
<petclinic:pivotal/>
</div>
</div>
<jsp:include page="../fragments/footer.jsp"/>
</body>
</html>
<!DOCTYPE html>
<%@ page session="false" %> <%@ page session="false" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="owners">
<html lang="en"> <jsp:attribute name="customScript">
<script>
<jsp:include page="../fragments/htmlHeader.jsp"/> $(function () {
<body> $("#birthDate").datepicker({dateFormat: 'yy/mm/dd'});
<petclinic:bodyHeader menuName="owners"/> });
</script>
<div class="container-fluid"> </jsp:attribute>
<div class="container xd-container"> <jsp:body>
<h2> <h2>
<c:if test="${pet['new']}">New </c:if> Pet <c:if test="${pet['new']}">New </c:if> Pet
</h2> </h2>
...@@ -49,17 +47,5 @@ ...@@ -49,17 +47,5 @@
</form:form> </form:form>
<c:if test="${!pet['new']}"> <c:if test="${!pet['new']}">
</c:if> </c:if>
</jsp:body>
<petclinic:pivotal/> </petclinic:layout>
</div>
</div>
<jsp:include page="../fragments/footer.jsp"/>
<script>
$(function () {
$("#birthDate").datepicker({dateFormat: 'yy/mm/dd'});
});
</script>
</body>
</html>
<!DOCTYPE html> <%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ page session="false" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
...@@ -9,15 +7,15 @@ ...@@ -9,15 +7,15 @@
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<html lang="en"> <petclinic:layout pageName="owners">
<jsp:attribute name="customScript">
<jsp:include page="../fragments/htmlHeader.jsp"/> <script>
$(function () {
<body> $("#date").datepicker({dateFormat: 'yy/mm/dd'});
});
<petclinic:bodyHeader menuName="owners"/> </script>
<div class="container-fluid"> </jsp:attribute>
<div class="container xd-container"> <jsp:body>
<h2><c:if test="${visit['new']}">New </c:if>Visit</h2> <h2><c:if test="${visit['new']}">New </c:if>Visit</h2>
<b>Pet</b> <b>Pet</b>
...@@ -68,16 +66,6 @@ ...@@ -68,16 +66,6 @@
</c:if> </c:if>
</c:forEach> </c:forEach>
</table> </table>
</jsp:body>
<petclinic:pivotal/> </petclinic:layout>
</div>
</div>
<jsp:include page="../fragments/footer.jsp"/>
<script>
$(function () {
$("#date").datepicker({dateFormat: 'yy/mm/dd'});
});
</script>
</body>
</html>
<!DOCTYPE html> <%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ page session="false" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="datatables" uri="http://github.com/dandelion/datatables" %> <%@ taglib prefix="datatables" uri="http://github.com/dandelion/datatables" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<html lang="en"> <petclinic:layout pageName="vets">
<h2>Veterinarians</h2>
<jsp:include page="../fragments/htmlHeader.jsp"/>
<datatables:table id="vets" data="${vets.vetList}" row="vet" cssClass="table table-striped"
<body> pageable="false" info="false">
<petclinic:bodyHeader menuName="vets"/> <datatables:column title="Name">
<div class="container-fluid"> <c:out value="${vet.firstName} ${vet.lastName}"/>
<div class="container xd-container"> </datatables:column>
<h2>Veterinarians</h2> <datatables:column title="Specialties">
<c:forEach var="specialty" items="${vet.specialties}">
<datatables:table id="vets" data="${vets.vetList}" row="vet" cssClass="table table-striped" <c:out value="${specialty.name}"/>
pageable="false" info="false"> </c:forEach>
<datatables:column title="Name"> <c:if test="${vet.nrOfSpecialties == 0}">none</c:if>
<c:out value="${vet.firstName} ${vet.lastName}"/> </datatables:column>
</datatables:column> </datatables:table>
<datatables:column title="Specialties">
<c:forEach var="specialty" items="${vet.specialties}"> <table class="table-buttons">
<c:out value="${specialty.name}"/> <tr>
</c:forEach> <td>
<c:if test="${vet.nrOfSpecialties == 0}">none</c:if> <a href="<spring:url value="/vets.xml" htmlEscape="true" />">View as XML</a>
</datatables:column> </td>
</datatables:table> <td>
<a href="<spring:url value="/vets.json" htmlEscape="true" />">View as JSON</a>
<table class="table-buttons"> </td>
<tr> </tr>
<td> </table>
<a href="<spring:url value="/vets.xml" htmlEscape="true" />">View as XML</a> </petclinic:layout>
</td>
<td>
<a href="<spring:url value="/vets.json" htmlEscape="true" />">View as JSON</a>
</td>
</tr>
</table>
<petclinic:pivotal/>
</div>
</div>
<jsp:include page="../fragments/footer.jsp"/>
</body>
</html>
<!DOCTYPE html> <%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ page session="false" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="home">
<html lang="en"> <h2><fmt:message key="welcome"/></h2>
<div class="row">
<jsp:include page="fragments/htmlHeader.jsp"/> <div class="col-md-12">
<spring:url value="/resources/images/pets.png" htmlEscape="true" var="petsImage"/>
<body> <img class="img-responsive" src="${petsImage}"/>
<petclinic:bodyHeader menuName="home"/>
<div class="container-fluid">
<div class="container xd-container">
<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> </div>
<petclinic:pivotal/>
</div> </div>
</div> </petclinic:layout>
<jsp:include page="fragments/footer.jsp"/>
</body>
</html>
<%@ 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="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core_1_1" %> <%@ 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" <%@ attribute name="name" required="true" rtexprvalue="true"
description="Name of the active menu: home, owners, vets or error" %> description="Name of the active menu: home, owners, vets or error" %>
<%-- Static navbar --%>
<nav class="navbar navbar-default" role="navigation"> <nav class="navbar navbar-default" role="navigation">
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">
...@@ -18,44 +17,29 @@ ...@@ -18,44 +17,29 @@
</div> </div>
<div class="navbar-collapse collapse"> <div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<c:choose>
<c:when test="${name eq 'home'}"> <petclinic:menuItem active="${name eq 'home'}" url="/" title="home page">
<c:set var="cssMenu" value="active"/> <span class="glyphicon glyphicon-home" aria-hidden="true"></span>
</c:when> <span>Home</span>
<c:otherwise> </petclinic:menuItem>
<c:set var="cssMenu" value=""/>
</c:otherwise> <petclinic:menuItem active="${name eq 'owners'}" url="/owners/find.html" title="find owners">
</c:choose> <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
<li class="${cssMenu}"><a href="<spring:url value="/" htmlEscape="true" />"><span class="glyphicon glyphicon-home" aria-hidden="true"></span><span> Home</span></a></li> <span>Find owners</span>
<c:choose> </petclinic:menuItem>
<c:when test="${name eq 'owners'}">
<c:set var="cssMenu" value="active"/> <petclinic:menuItem active="${name eq 'vets'}" url="/vets.html" title="veterinarians">
</c:when> <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
<c:otherwise> <span>Veterinarians</span>
<c:set var="cssMenu" value=""/> </petclinic:menuItem>
</c:otherwise>
</c:choose> <petclinic:menuItem active="${name eq 'error'}" url="/oups.html"
<li class="${cssMenu}"><a href="<spring:url value="/owners/find.html" htmlEscape="true" />"><span class="glyphicon glyphicon-search" aria-hidden="true"></span><span> Find owners</span></a></li> title="trigger a RuntimeException to see how it is handled">
<c:choose> <span class="glyphicon glyphicon-warning-sign" aria-hidden="true"></span>
<c:when test="${name eq 'vets'}"> <span>Error</span>
<c:set var="cssMenu" value="active"/> </petclinic:menuItem>
</c:when>
<c:otherwise>
<c:set var="cssMenu" value=""/>
</c:otherwise>
</c:choose>
<li class="${cssMenu}"><a href="<spring:url value="/vets.html" htmlEscape="true" />"><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span><span> Veterinarians</span></a></li>
<c:choose>
<c:when test="${name eq 'error'}">
<c:set var="cssMenu" value="active"/>
</c:when>
<c:otherwise>
<c:set var="cssMenu" value=""/>
</c:otherwise>
</c:choose>
<li class="${cssMenu}"><a href="<spring:url value="/oups.html" htmlEscape="true" />"
title="trigger a RuntimeException to see how it is handled"><span class="glyphicon glyphicon-warning-sign" aria-hidden="true"></span><span> Error</span></a></li>
</ul> </ul>
</div> <%--/.nav-collapse --%> </div>
</div> <%--/.container-fluid --%> </div>
</nav> </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>
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