mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 15:55:49 +00:00
Configurado usando jsp
This commit is contained in:
parent
fc172600be
commit
f110d7d204
33 changed files with 542 additions and 340 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,3 +10,4 @@ target/*
|
||||||
.sts4-cache/
|
.sts4-cache/
|
||||||
.vscode
|
.vscode
|
||||||
_site/
|
_site/
|
||||||
|
/bin/
|
||||||
|
|
19
pom.xml
19
pom.xml
|
@ -54,10 +54,6 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
@ -69,6 +65,21 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-taglibs</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Jsp -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>jstl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tomcat.embed</groupId>
|
||||||
|
<artifactId>tomcat-embed-jasper</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Databases - Uses H2 by default -->
|
<!-- Databases - Uses H2 by default -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# database init, supports mysql too
|
# database init, supports mysql too
|
||||||
database=mysql
|
database=mysql
|
||||||
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/petclinic}
|
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/cheapy?serverTimezone=UTC}
|
||||||
spring.datasource.username=${MYSQL_USER:petclinic}
|
spring.datasource.username=${MYSQL_USER:cheapy}
|
||||||
spring.datasource.password=${MYSQL_PASS:petclinic}
|
spring.datasource.password=${MYSQL_PASS:cheapy}
|
||||||
# SQL is written to be idempotent so this is safe
|
# SQL is written to be idempotent so this is safe
|
||||||
spring.datasource.initialization-mode=always
|
spring.datasource.initialization-mode=always
|
||||||
|
|
|
@ -13,6 +13,10 @@ spring.jpa.open-in-view=false
|
||||||
# Internationalization
|
# Internationalization
|
||||||
spring.messages.basename=messages/messages
|
spring.messages.basename=messages/messages
|
||||||
|
|
||||||
|
# Views
|
||||||
|
spring.mvc.view.prefix: /WEB-INF/jsp/
|
||||||
|
spring.mvc.view.suffix: .jsp
|
||||||
|
|
||||||
# Actuator
|
# Actuator
|
||||||
management.endpoints.web.exposure.include=*
|
management.endpoints.web.exposure.include=*
|
||||||
|
|
||||||
|
@ -23,3 +27,5 @@ logging.level.org.springframework=INFO
|
||||||
|
|
||||||
# Maximum time static resources should be cached
|
# Maximum time static resources should be cached
|
||||||
spring.resources.cache.cachecontrol.max-age=12h
|
spring.resources.cache.cachecontrol.max-age=12h
|
||||||
|
|
||||||
|
spring.profiles.active=mysql
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
CREATE DATABASE IF NOT EXISTS petclinic;
|
CREATE DATABASE IF NOT EXISTS cheapy;
|
||||||
|
|
||||||
ALTER DATABASE petclinic
|
ALTER DATABASE cheapy
|
||||||
DEFAULT CHARACTER SET utf8
|
DEFAULT CHARACTER SET utf8
|
||||||
DEFAULT COLLATE utf8_general_ci;
|
DEFAULT COLLATE utf8_general_ci;
|
||||||
|
|
||||||
GRANT ALL PRIVILEGES ON petclinic.* TO 'petclinic'@'%' IDENTIFIED BY 'petclinic';
|
CREATE USER 'cheapy'@'%' IDENTIFIED BY 'cheapy';
|
||||||
|
GRANT ALL PRIVILEGES ON cheapy.* TO 'cheapy'@'%';
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html xmlns:th="https://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'error')}">
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<img src="../static/resources/images/pets.png" th:src="@{/resources/images/pets.png}"/>
|
|
||||||
<h2>Something happened...</h2>
|
|
||||||
<p th:text="${message}">Exception message</p>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
|
@ -1,30 +0,0 @@
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<form>
|
|
||||||
<th:block th:fragment="input (label, name, type)">
|
|
||||||
<div th:with="valid=${!#fields.hasErrors(name)}"
|
|
||||||
th:class="${'form-group' + (valid ? '' : ' has-error')}"
|
|
||||||
class="form-group">
|
|
||||||
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<div th:switch="${type}">
|
|
||||||
<input th:case="'text'" class="form-control" type="text" th:field="*{__${name}__}" />
|
|
||||||
<input th:case="'date'" class="form-control" type="text" th:field="*{__${name}__}"
|
|
||||||
placeholder="YYYY-MM-DD" title="Enter a date in this format: YYYY-MM-DD"
|
|
||||||
pattern="(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))"/>
|
|
||||||
</div>
|
|
||||||
<span th:if="${valid}"
|
|
||||||
class="glyphicon glyphicon-ok form-control-feedback"
|
|
||||||
aria-hidden="true"></span>
|
|
||||||
<th:block th:if="${!valid}">
|
|
||||||
<span
|
|
||||||
class="glyphicon glyphicon-remove form-control-feedback"
|
|
||||||
aria-hidden="true"></span>
|
|
||||||
<span class="help-inline" th:errors="*{__${name}__}">Error</span>
|
|
||||||
</th:block>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</th:block>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,104 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<html th:fragment="layout (template, menu)">
|
|
||||||
|
|
||||||
<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">
|
|
||||||
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" th:href="@{/resources/images/cheapy.png}">
|
|
||||||
|
|
||||||
<title>Cheapy</title>
|
|
||||||
|
|
||||||
<!--[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]-->
|
|
||||||
|
|
||||||
<link rel="stylesheet" th:href="@{/resources/css/petclinic.css}" />
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="navbar navbar-default" role="navigation">
|
|
||||||
<div class="container">
|
|
||||||
<div class="navbar-header">
|
|
||||||
<a class="navbar-brand" th:href="@{/}"><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" th:remove="all">
|
|
||||||
|
|
||||||
<li th:fragment="menuItem (link,active,title,glyph,text)" class="active"
|
|
||||||
th:class="${active==menu ? 'active' : ''}">
|
|
||||||
<a th:href="@{__${link}__}" th:title="${title}">
|
|
||||||
<span th:class="'glyphicon glyphicon-'+${glyph}" class="glyphicon glyphicon-home"
|
|
||||||
aria-hidden="true"></span>
|
|
||||||
<span th:text="${text}">Template</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<ul class="nav navbar-nav navbar-right">
|
|
||||||
|
|
||||||
<li th:replace="::menuItem ('/','home','home page','home','Home')">
|
|
||||||
<span class="glyphicon glyphicon-home" aria-hidden="true"></span>
|
|
||||||
<span>Home</span>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li th:replace="::menuItem ('/owners/find','owners','find owners','search','Find owners')">
|
|
||||||
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
|
|
||||||
<span>Find owners</span>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li th:replace="::menuItem ('/vets.html','vets','veterinarians','th-list','Veterinarians')">
|
|
||||||
<span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
|
|
||||||
<span>Veterinarians</span>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li
|
|
||||||
th:replace="::menuItem ('/oups','error','trigger a RuntimeException to see how it is handled','warning-sign','Error')">
|
|
||||||
<span class="glyphicon glyphicon-warning-sign" aria-hidden="true"></span>
|
|
||||||
<span>Error</span>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="container xd-container">
|
|
||||||
|
|
||||||
<th:block th:include="${template}" />
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 text-center">
|
|
||||||
<img src="../static/resources/images/spring-pivotal-logo.png"
|
|
||||||
th:src="@{/resources/images/spring-pivotal-logo.png}" alt="Sponsored by Pivotal" /></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script th:src="@{/webjars/jquery/jquery.min.js}"></script>
|
|
||||||
<script th:src="@{/webjars/jquery-ui/jquery-ui.min.js}"></script>
|
|
||||||
<script th:src="@{/webjars/bootstrap/js/bootstrap.min.js}"></script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
|
@ -1,29 +0,0 @@
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<form>
|
|
||||||
<th:block th:fragment="select (label, name, items)">
|
|
||||||
<div th:with="valid=${!#fields.hasErrors(name)}"
|
|
||||||
th:class="${'form-group' + (valid ? '' : ' has-error')}"
|
|
||||||
class="form-group">
|
|
||||||
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
|
|
||||||
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<select th:field="*{__${name}__}">
|
|
||||||
<option th:each="item : ${items}" th:value="${item}"
|
|
||||||
th:text="${item}">dog</option>
|
|
||||||
</select>
|
|
||||||
<span th:if="${valid}"
|
|
||||||
class="glyphicon glyphicon-ok form-control-feedback"
|
|
||||||
aria-hidden="true"></span>
|
|
||||||
<th:block th:if="${!valid}">
|
|
||||||
<span
|
|
||||||
class="glyphicon glyphicon-remove form-control-feedback"
|
|
||||||
aria-hidden="true"></span>
|
|
||||||
<span class="help-inline" th:errors="*{__${name}__}">Error</span>
|
|
||||||
</th:block>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</th:block>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,30 +0,0 @@
|
||||||
<html xmlns:th="https://www.thymeleaf.org"
|
|
||||||
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h2>Owner</h2>
|
|
||||||
<form th:object="${owner}" class="form-horizontal" id="add-owner-form" method="post">
|
|
||||||
<div class="form-group has-feedback">
|
|
||||||
<input
|
|
||||||
th:replace="~{fragments/inputField :: input ('First Name', 'firstName', 'text')}" />
|
|
||||||
<input
|
|
||||||
th:replace="~{fragments/inputField :: input ('Last Name', 'lastName', 'text')}" />
|
|
||||||
<input
|
|
||||||
th:replace="~{fragments/inputField :: input ('Address', 'address', 'text')}" />
|
|
||||||
<input
|
|
||||||
th:replace="~{fragments/inputField :: input ('City', 'city', 'text')}" />
|
|
||||||
<input
|
|
||||||
th:replace="~{fragments/inputField :: input ('Telephone', 'telephone', 'text')}" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
|
||||||
<button
|
|
||||||
th:with="text=${owner['new']} ? 'Add Owner' : 'Update Owner'"
|
|
||||||
class="btn btn-default" type="submit" th:text="${text}">Add
|
|
||||||
Owner</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,35 +0,0 @@
|
||||||
<html xmlns:th="https://www.thymeleaf.org"
|
|
||||||
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h2>Find Owners</h2>
|
|
||||||
|
|
||||||
<form th:object="${owner}" th:action="@{/owners}" method="get"
|
|
||||||
class="form-horizontal" id="search-owner-form">
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="control-group" id="lastNameGroup">
|
|
||||||
<label class="col-sm-2 control-label">Last name </label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<input class="form-control" th:field="*{lastName}" size="30"
|
|
||||||
maxlength="80" /> <span class="help-inline"><div
|
|
||||||
th:if="${#fields.hasAnyErrors()}">
|
|
||||||
<p th:each="err : ${#fields.allErrors()}" th:text="${err}">Error</p>
|
|
||||||
</div></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>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<a class="btn btn-default" th:href="@{/owners/new}">Add Owner</a>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,43 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html xmlns:th="https://www.thymeleaf.org"
|
|
||||||
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
|
|
||||||
<h2>Owner Information</h2>
|
|
||||||
|
|
||||||
|
|
||||||
<table class="table table-striped" th:object="${owner}">
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<td><b th:text="*{firstName + ' ' + lastName}"></b></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Address</th>
|
|
||||||
<td th:text="*{address}"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>City</th>
|
|
||||||
<td th:text="*{city}"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Telephone</th>
|
|
||||||
<td th:text="*{telephone}"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<a th:href="@{{id}/edit(id=${owner.id})}" class="btn btn-default">Edit
|
|
||||||
Owner</a>
|
|
||||||
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
|
@ -1,32 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html xmlns:th="https://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h2>Owners</h2>
|
|
||||||
|
|
||||||
<table id="owners" 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>
|
|
||||||
<tr th:each="owner : ${selections}">
|
|
||||||
<td>
|
|
||||||
<a th:href="@{/owners/__${owner.id}__}" th:text="${owner.firstName + ' ' + owner.lastName}"/></a>
|
|
||||||
</td>
|
|
||||||
<td th:text="${owner.address}"/>
|
|
||||||
<td th:text="${owner.city}"/>
|
|
||||||
<td th:text="${owner.telephone}"/>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,16 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html xmlns:th="https://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>
|
|
7
src/main/webapp/WEB-INF/jetty-web.xml
Normal file
7
src/main/webapp/WEB-INF/jetty-web.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?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>
|
14
src/main/webapp/WEB-INF/jsp/exception.jsp
Normal file
14
src/main/webapp/WEB-INF/jsp/exception.jsp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<%@ 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>
|
|
@ -0,0 +1,34 @@
|
||||||
|
<%@ 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>
|
40
src/main/webapp/WEB-INF/jsp/owners/findOwners.jsp
Normal file
40
src/main/webapp/WEB-INF/jsp/owners/findOwners.jsp
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<%@ 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" %>
|
||||||
|
<%@ taglib prefix="sec"
|
||||||
|
uri="http://www.springframework.org/security/tags"%>
|
||||||
|
<!-- >%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%-->
|
||||||
|
|
||||||
|
<petclinic:layout pageName="owners">
|
||||||
|
|
||||||
|
<h2>Find Owners</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<form:form modelAttribute="owner" action="/owners" 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/>
|
||||||
|
<sec:authorize access="hasAuthority('admin')">
|
||||||
|
<a class="btn btn-default" href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
|
||||||
|
</sec:authorize>
|
||||||
|
|
||||||
|
</petclinic:layout>
|
36
src/main/webapp/WEB-INF/jsp/owners/ownerDetails.jsp
Normal file
36
src/main/webapp/WEB-INF/jsp/owners/ownerDetails.jsp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||||
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||||
|
<%@ 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" var="editUrl">
|
||||||
|
<spring:param name="ownerId" value="${owner.id}"/>
|
||||||
|
</spring:url>
|
||||||
|
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Edit Owner</a>
|
||||||
|
|
||||||
|
</petclinic:layout>
|
44
src/main/webapp/WEB-INF/jsp/owners/ownersList.jsp
Normal file
44
src/main/webapp/WEB-INF/jsp/owners/ownersList.jsp
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<%@ 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="ownersTable" 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}" 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>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</petclinic:layout>
|
36
src/main/webapp/WEB-INF/jsp/users/createOwnerForm.jsp
Normal file
36
src/main/webapp/WEB-INF/jsp/users/createOwnerForm.jsp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<%@ 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"/>
|
||||||
|
<petclinic:inputField label="Username" name="user.username"/>
|
||||||
|
<petclinic:inputField label="Password" name="user.password"/>
|
||||||
|
</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>
|
15
src/main/webapp/WEB-INF/jsp/welcome.jsp
Normal file
15
src/main/webapp/WEB-INF/jsp/welcome.jsp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<%@ 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" %>
|
||||||
|
<!-- %@ taglib prefix="sec" uri="http://www.springframework.org/security/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>
|
4
src/main/webapp/WEB-INF/no-spring-config-files-there.txt
Normal file
4
src/main/webapp/WEB-INF/no-spring-config-files-there.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
All Spring config files (including Spring MVC ones) are inside src/main/resource.
|
||||||
|
There are mostly 2 reasons to that:
|
||||||
|
- All Spring config files are grouped into one single place
|
||||||
|
- It is simpler to reference them from inside JUnit tests
|
7
src/main/webapp/WEB-INF/tags/bodyHeader.tag
Normal file
7
src/main/webapp/WEB-INF/tags/bodyHeader.tag
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<%@ 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}"/>
|
14
src/main/webapp/WEB-INF/tags/footer.tag
Normal file
14
src/main/webapp/WEB-INF/tags/footer.tag
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<%@ 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>
|
||||||
|
|
35
src/main/webapp/WEB-INF/tags/htmlHeader.tag
Normal file
35
src/main/webapp/WEB-INF/tags/htmlHeader.tag
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<%@ 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>
|
||||||
|
|
||||||
|
<%-- CSS generated from LESS --%>
|
||||||
|
<spring:url value="/resources/css/petclinic.css" var="petclinicCss"/>
|
||||||
|
<link href="${petclinicCss}" rel="stylesheet"/>
|
||||||
|
|
||||||
|
|
||||||
|
<%-- 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]-->
|
||||||
|
|
||||||
|
<!-- Only datepicker is used -->
|
||||||
|
<spring:url value="/webjars/jquery-ui/1.11.4/jquery-ui.min.css" var="jQueryUiCss"/>
|
||||||
|
<link href="${jQueryUiCss}" rel="stylesheet"/>
|
||||||
|
<spring:url value="/webjars/jquery-ui/1.11.4/jquery-ui.theme.min.css" var="jQueryUiThemeCss"/>
|
||||||
|
<link href="${jQueryUiThemeCss}" rel="stylesheet"/>
|
||||||
|
</head>
|
26
src/main/webapp/WEB-INF/tags/inputField.tag
Normal file
26
src/main/webapp/WEB-INF/tags/inputField.tag
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<%@ 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>
|
27
src/main/webapp/WEB-INF/tags/layout.tag
Normal file
27
src/main/webapp/WEB-INF/tags/layout.tag
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<%@ 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>
|
11
src/main/webapp/WEB-INF/tags/localDate.tag
Normal file
11
src/main/webapp/WEB-INF/tags/localDate.tag
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<%@ tag body-content="empty" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
|
||||||
|
|
||||||
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
|
||||||
|
<%@ attribute name="date" required="true" type="java.time.LocalDate" %>
|
||||||
|
<%@ attribute name="pattern" required="true" type="java.lang.String" %>
|
||||||
|
|
||||||
|
|
||||||
|
<fmt:parseDate value="${date}" pattern="yyyy-MM-dd" var="parsedDate" type="date"/>
|
||||||
|
<fmt:formatDate value="${parsedDate}" type="date" pattern="${pattern}"/>
|
110
src/main/webapp/WEB-INF/tags/menu.tag
Normal file
110
src/main/webapp/WEB-INF/tags/menu.tag
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
<%@ 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="sec"
|
||||||
|
uri="http://www.springframework.org/security/tags"%>
|
||||||
|
<!-- >%@ taglib prefix="sec" uri="http://www.springframework.org/security/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">
|
||||||
|
|
||||||
|
<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"
|
||||||
|
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"
|
||||||
|
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"
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<sec:authorize access="!isAuthenticated()">
|
||||||
|
<li><a href="<c:url value="/login" />">Login</a></li>
|
||||||
|
<li><a href="<c:url value="/users/new" />">Register</a></li>
|
||||||
|
</sec:authorize>
|
||||||
|
<sec:authorize access="isAuthenticated()">
|
||||||
|
<li class="dropdown"><a href="#" class="dropdown-toggle"
|
||||||
|
data-toggle="dropdown"> <span class="glyphicon glyphicon-user"></span>
|
||||||
|
<strong><sec:authentication property="name" /></strong> <span
|
||||||
|
class="glyphicon glyphicon-chevron-down"></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li>
|
||||||
|
<div class="navbar-login">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<p class="text-center">
|
||||||
|
<span class="glyphicon glyphicon-user icon-size"></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<p class="text-left">
|
||||||
|
<strong><sec:authentication property="name" /></strong>
|
||||||
|
</p>
|
||||||
|
<p class="text-left">
|
||||||
|
<a href="<c:url value="/logout" />"
|
||||||
|
class="btn btn-primary btn-block btn-sm">Logout</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<!--
|
||||||
|
<li>
|
||||||
|
<div class="navbar-login navbar-login-session">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<p>
|
||||||
|
<a href="#" class="btn btn-primary btn-block">My Profile</a>
|
||||||
|
<a href="#" class="btn btn-danger btn-block">Change
|
||||||
|
Password</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
-->
|
||||||
|
</ul></li>
|
||||||
|
</sec:authorize>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
13
src/main/webapp/WEB-INF/tags/menuItem.tag
Normal file
13
src/main/webapp/WEB-INF/tags/menuItem.tag
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<%@ 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>
|
10
src/main/webapp/WEB-INF/tags/pivotal.tag
Normal file
10
src/main/webapp/WEB-INF/tags/pivotal.tag
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<%@ 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>
|
30
src/main/webapp/WEB-INF/tags/selectField.tag
Normal file
30
src/main/webapp/WEB-INF/tags/selectField.tag
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<%@ 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" %>
|
||||||
|
<%@ attribute name="names" required="true" rtexprvalue="true" type="java.util.List"
|
||||||
|
description="Names in the list" %>
|
||||||
|
<%@ attribute name="size" required="true" rtexprvalue="true"
|
||||||
|
description="Size of Select" %>
|
||||||
|
|
||||||
|
<spring:bind path="${name}">
|
||||||
|
<c:set var="cssGroup" value="form-group ${status.error ? '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:select class="form-control" path="${name}" items="${names}" size="${size}"/>
|
||||||
|
<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>
|
Loading…
Reference in a new issue