Convert to jar with thymeleaf
588
pom.xml
|
@ -1,340 +1,264 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<groupId>org.springframework.samples</groupId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>springboot-petclinic</artifactId>
|
<groupId>org.springframework.samples</groupId>
|
||||||
<version>1.4.1</version>
|
<artifactId>springboot-petclinic</artifactId>
|
||||||
<parent>
|
<version>1.4.1</version>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>1.4.1.RELEASE</version>
|
||||||
|
</parent>
|
||||||
|
<name>petclinic</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
|
||||||
|
<!-- Generic properties -->
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
|
||||||
|
<!-- Web dependencies -->
|
||||||
|
<webjars-bootstrap.version>3.3.6</webjars-bootstrap.version>
|
||||||
|
<webjars-jquery-ui.version>1.11.4</webjars-jquery-ui.version>
|
||||||
|
<webjars-jquery.version>2.2.4</webjars-jquery.version>
|
||||||
|
|
||||||
|
<thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
|
||||||
|
<thymeleaf-layout-dialect.version>2.0.4</thymeleaf-layout-dialect.version>
|
||||||
|
|
||||||
|
<cobertura.version>2.7</cobertura.version>
|
||||||
|
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring and Spring Boot dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-cache</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Databases - Uses HSQL by default -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hsqldb</groupId>
|
||||||
|
<artifactId>hsqldb</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- EhCache -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.cache</groupId>
|
||||||
|
<artifactId>cache-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.ehcache</groupId>
|
||||||
|
<artifactId>ehcache</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- webjars -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.webjars</groupId>
|
||||||
|
<artifactId>webjars-locator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.webjars</groupId>
|
||||||
|
<artifactId>jquery</artifactId>
|
||||||
|
<version>${webjars-jquery.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.webjars</groupId>
|
||||||
|
<artifactId>jquery-ui</artifactId>
|
||||||
|
<version>${webjars-jquery-ui.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.webjars</groupId>
|
||||||
|
<artifactId>bootstrap</artifactId>
|
||||||
|
<version>${webjars-bootstrap.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- end of webjars -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<version>1.4.1.RELEASE</version>
|
<executions>
|
||||||
</parent>
|
<execution>
|
||||||
<name>petclinic</name>
|
<!-- Spring Boot Actuator displays build-related information
|
||||||
<packaging>war</packaging>
|
if a META-INF/build-info.properties file is present -->
|
||||||
|
<goals>
|
||||||
|
<goal>build-info</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<additionalProperties>
|
||||||
|
<encoding.source>${project.build.sourceEncoding}</encoding.source>
|
||||||
|
<encoding.reporting>${project.reporting.outputEncoding}</encoding.reporting>
|
||||||
|
<java.source>${maven.compiler.source}</java.source>
|
||||||
|
<java.target>${maven.compiler.target}</java.target>
|
||||||
|
</additionalProperties>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>cobertura-maven-plugin</artifactId>
|
||||||
|
<version>${cobertura.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<check />
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>clean</goal>
|
||||||
|
<goal>check</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<properties>
|
<!-- Spring Boot Actuator displays build-related information if a git.properties
|
||||||
|
file is present at the classpath -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>pl.project13.maven</groupId>
|
||||||
|
<artifactId>git-commit-id-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>revision</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<verbose>true</verbose>
|
||||||
|
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
|
||||||
|
<generateGitPropertiesFile>true</generateGitPropertiesFile>
|
||||||
|
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties
|
||||||
|
</generateGitPropertiesFilename>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<!-- Generic properties -->
|
<plugin>
|
||||||
<java.version>1.7</java.version>
|
<!-- right now lesscss maven plugin does NOT support @Import from
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
classpath https://github.com/marceloverdijk/lesscss-maven-plugin/issues/72
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
workaround here will be unpacking the bootstrap on-the-fly remove this plugin
|
||||||
<docker.image.prefix>arey</docker.image.prefix>
|
config when the issue is resolved OR a better resolution is found -->
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>unpack</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>unpack</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactItems>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>org.webjars</groupId>
|
||||||
|
<artifactId>bootstrap</artifactId>
|
||||||
|
<version>${webjars-bootstrap.version}</version>
|
||||||
|
<overWrite>false</overWrite>
|
||||||
|
<outputDirectory>${project.basedir}/target/less
|
||||||
|
</outputDirectory>
|
||||||
|
<includes>**/*.less</includes>
|
||||||
|
</artifactItem>
|
||||||
|
</artifactItems>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<!-- Web dependencies -->
|
<plugin>
|
||||||
<webjars-bootstrap.version>3.3.6</webjars-bootstrap.version>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<webjars-jquery-ui.version>1.11.4</webjars-jquery-ui.version>
|
<executions>
|
||||||
<webjars-jquery.version>2.2.4</webjars-jquery.version>
|
<execution>
|
||||||
|
<id>copy-resources</id>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/less</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/less</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<cobertura.version>2.7</cobertura.version>
|
<plugin>
|
||||||
|
<groupId>org.lesscss</groupId>
|
||||||
|
<artifactId>lesscss-maven-plugin</artifactId>
|
||||||
|
<version>1.7.0.1.1</version>
|
||||||
|
<configuration>
|
||||||
|
<sourceDirectory>${project.build.directory}/less</sourceDirectory>
|
||||||
|
<outputDirectory>${project.build.directory}/classes/static/resources/css</outputDirectory>
|
||||||
|
<compress>true</compress>
|
||||||
|
<includes>
|
||||||
|
<include>petclinic.less</include>
|
||||||
|
</includes>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<reporting>
|
||||||
|
<plugins>
|
||||||
|
<!-- integrate maven-cobertura-plugin to project site -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>cobertura-maven-plugin</artifactId>
|
||||||
|
<version>${cobertura.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<formats>
|
||||||
|
<format>html</format>
|
||||||
|
</formats>
|
||||||
|
<check />
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- Spring et Spring Boot dependencies -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-cache</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
<!-- Uncomment bellow lines in order to deploy the Springboot Petlinic WAR file into an external Jetty -->
|
|
||||||
<!--exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions-->
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.tomcat.embed</groupId>
|
|
||||||
<artifactId>tomcat-embed-jasper</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
<artifactId>jstl</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Databases - Uses HSQL by default -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hsqldb</groupId>
|
|
||||||
<artifactId>hsqldb</artifactId>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- For MySql only -->
|
|
||||||
<!--dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
<version>${mysql-driver.version}</version>
|
|
||||||
</dependency-->
|
|
||||||
|
|
||||||
<!-- EhCache -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.cache</groupId>
|
|
||||||
<artifactId>cache-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.ehcache</groupId>
|
|
||||||
<artifactId>ehcache</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- webjars -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.webjars</groupId>
|
|
||||||
<artifactId>jquery</artifactId>
|
|
||||||
<version>${webjars-jquery.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.webjars</groupId>
|
|
||||||
<artifactId>jquery-ui</artifactId>
|
|
||||||
<version>${webjars-jquery-ui.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.webjars</groupId>
|
|
||||||
<artifactId>bootstrap</artifactId>
|
|
||||||
<version>${webjars-bootstrap.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- end of webjars -->
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<!-- Maven plugin versions are mentioned in order to guarantee the build reproducibility in the long term -->
|
|
||||||
<build>
|
|
||||||
<finalName>petclinic</finalName>
|
|
||||||
<defaultGoal>install</defaultGoal>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<!-- Spring Boot Actuator displays build-related information if a META-INF/build-info.properties file is present -->
|
|
||||||
<goals>
|
|
||||||
<goal>build-info</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<additionalProperties>
|
|
||||||
<encoding.source>${project.build.sourceEncoding}</encoding.source>
|
|
||||||
<encoding.reporting>${project.reporting.outputEncoding}</encoding.reporting>
|
|
||||||
<java.source>${maven.compiler.source}</java.source>
|
|
||||||
<java.target>${maven.compiler.target}</java.target>
|
|
||||||
</additionalProperties>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.0</version>
|
|
||||||
<configuration>
|
|
||||||
<compilerArguments>
|
|
||||||
<Xlint/>
|
|
||||||
</compilerArguments>
|
|
||||||
<verbose>true</verbose>
|
|
||||||
<source>${java.version}</source>
|
|
||||||
<target>${java.version}</target>
|
|
||||||
<showWarnings>true</showWarnings>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>2.13</version>
|
|
||||||
<configuration>
|
|
||||||
<includes>
|
|
||||||
<include>**/*Tests.java</include>
|
|
||||||
</includes>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-eclipse-plugin</artifactId>
|
|
||||||
<version>2.9</version>
|
|
||||||
<configuration>
|
|
||||||
<downloadSources>true</downloadSources>
|
|
||||||
<downloadJavadocs>true</downloadJavadocs>
|
|
||||||
<wtpversion>2.0</wtpversion>
|
|
||||||
<sourceIncludes>
|
|
||||||
<sourceInclude>**/*.*</sourceInclude>
|
|
||||||
</sourceIncludes>
|
|
||||||
<additionalBuildcommands>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.springframework.ide.eclipse.core.springbuilder</name>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
</buildCommand>
|
|
||||||
</additionalBuildcommands>
|
|
||||||
<additionalProjectnatures>
|
|
||||||
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
|
|
||||||
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
|
|
||||||
<projectnature>org.eclipse.m2e.core.maven2Nature</projectnature>
|
|
||||||
</additionalProjectnatures>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
<version>${cobertura.version}</version>
|
|
||||||
<configuration>
|
|
||||||
<check/>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>clean</goal>
|
|
||||||
<goal>check</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!-- Spring Boot Actuator displays build-related information if a git.properties file is present at the classpath -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>pl.project13.maven</groupId>
|
|
||||||
<artifactId>git-commit-id-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>revision</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<verbose>true</verbose>
|
|
||||||
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
|
|
||||||
<generateGitPropertiesFile>true</generateGitPropertiesFile>
|
|
||||||
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties
|
|
||||||
</generateGitPropertiesFilename>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<!--
|
|
||||||
right now lesscss maven plugin does NOT support @Import from classpath
|
|
||||||
https://github.com/marceloverdijk/lesscss-maven-plugin/issues/72
|
|
||||||
|
|
||||||
workaround here will be unpacking the bootstrap on-the-fly
|
|
||||||
|
|
||||||
remove this plugin config when the issue is resolved OR a better resolution is found
|
|
||||||
-->
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>unpack</id>
|
|
||||||
<phase>process-resources</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>unpack</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<artifactItems>
|
|
||||||
<artifactItem>
|
|
||||||
<groupId>org.webjars</groupId>
|
|
||||||
<artifactId>bootstrap</artifactId>
|
|
||||||
<version>3.3.6</version>
|
|
||||||
<overWrite>false</overWrite>
|
|
||||||
<outputDirectory>${project.basedir}/src/main/webapp/resources/generated
|
|
||||||
</outputDirectory>
|
|
||||||
<includes>**/*.less</includes>
|
|
||||||
</artifactItem>
|
|
||||||
</artifactItems>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<!-- refer to dependency plugin comments above -->
|
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<filesets>
|
|
||||||
<fileset>
|
|
||||||
<directory>${project.basedir}/src/main/webapp/resources/generated</directory>
|
|
||||||
</fileset>
|
|
||||||
</filesets>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.lesscss</groupId>
|
|
||||||
<artifactId>lesscss-maven-plugin</artifactId>
|
|
||||||
<version>1.7.0.1.1</version>
|
|
||||||
<configuration>
|
|
||||||
<sourceDirectory>${project.basedir}/src/main/webapp/resources/less</sourceDirectory>
|
|
||||||
<outputDirectory>${project.basedir}/src/main/webapp/resources/generated</outputDirectory>
|
|
||||||
<compress>true</compress>
|
|
||||||
<includes>
|
|
||||||
<include>petclinic.less</include>
|
|
||||||
</includes>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>process-resources</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>compile</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>com.spotify</groupId>
|
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
|
||||||
<version>0.4.11</version>
|
|
||||||
<configuration>
|
|
||||||
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
|
|
||||||
<dockerDirectory>src/main/docker</dockerDirectory>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<targetPath>/</targetPath>
|
|
||||||
<directory>${project.build.directory}</directory>
|
|
||||||
<include>${project.build.finalName}.war</include>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
<forceTags>true</forceTags>
|
|
||||||
<imageTags>
|
|
||||||
<imageTag>${project.version}</imageTag>
|
|
||||||
<imageTag>latest</imageTag>
|
|
||||||
</imageTags>
|
|
||||||
<useConfigFile>true</useConfigFile>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<reporting>
|
|
||||||
<plugins>
|
|
||||||
<!-- integrate maven-cobertura-plugin to project site -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
<version>${cobertura.version}</version>
|
|
||||||
<configuration>
|
|
||||||
<formats>
|
|
||||||
<format>html</format>
|
|
||||||
</formats>
|
|
||||||
<check/>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</reporting>
|
|
||||||
|
|
||||||
<url>demopetclinic</url>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
FROM openjdk:alpine
|
|
||||||
MAINTAINER Antoine Rey <antoine.rey@free.fr>
|
|
||||||
# Spring Boot application creates working directories for Tomcat by default
|
|
||||||
VOLUME /tmp
|
|
||||||
ADD petclinic.war petclinic.war
|
|
||||||
RUN sh -c 'touch /petclinic.war'
|
|
||||||
# To reduce Tomcat startup time we added a system property pointing to "/dev/urandom" as a source of entropy.
|
|
||||||
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/petclinic.war"]
|
|
|
@ -18,23 +18,16 @@ package org.springframework.samples.petclinic;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PetClinic Spring Boot Application.
|
* PetClinic Spring Boot Application.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class PetClinicApplication extends SpringBootServletInitializer {
|
public class PetClinicApplication {
|
||||||
|
|
||||||
@Override
|
public static void main(String[] args) throws Exception {
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
SpringApplication.run(PetClinicApplication.class, args);
|
||||||
return application.sources(PetClinicApplication.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
SpringApplication.run(PetClinicApplication.class, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ public class Pet extends NamedEntity {
|
||||||
private Owner owner;
|
private Owner owner;
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "pet", fetch = FetchType.EAGER)
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "pet", fetch = FetchType.EAGER)
|
||||||
private Set<Visit> visits;
|
private Set<Visit> visits = new LinkedHashSet<>();
|
||||||
|
|
||||||
|
|
||||||
public void setBirthDate(Date birthDate) {
|
public void setBirthDate(Date birthDate) {
|
||||||
|
|
|
@ -17,11 +17,9 @@ package org.springframework.samples.petclinic.repository;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.springframework.dao.DataAccessException;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.Repository;
|
import org.springframework.data.repository.Repository;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.samples.petclinic.model.BaseEntity;
|
|
||||||
import org.springframework.samples.petclinic.model.Owner;
|
import org.springframework.samples.petclinic.model.Owner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +49,7 @@ public interface OwnerRepository extends Repository<Owner, Integer> {
|
||||||
* @return the {@link Owner} if found
|
* @return the {@link Owner} if found
|
||||||
*/
|
*/
|
||||||
@Query("SELECT owner FROM Owner owner left join fetch owner.pets WHERE owner.id =:id")
|
@Query("SELECT owner FROM Owner owner left join fetch owner.pets WHERE owner.id =:id")
|
||||||
Owner findById(@Param("id") int id);
|
Owner findById(@Param("id") Integer id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save an {@link Owner} to the data store, either inserting or updating it.
|
* Save an {@link Owner} to the data store, either inserting or updating it.
|
||||||
|
|
|
@ -17,10 +17,8 @@ package org.springframework.samples.petclinic.repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.dao.DataAccessException;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.Repository;
|
import org.springframework.data.repository.Repository;
|
||||||
import org.springframework.samples.petclinic.model.BaseEntity;
|
|
||||||
import org.springframework.samples.petclinic.model.Pet;
|
import org.springframework.samples.petclinic.model.Pet;
|
||||||
import org.springframework.samples.petclinic.model.PetType;
|
import org.springframework.samples.petclinic.model.PetType;
|
||||||
|
|
||||||
|
@ -47,7 +45,7 @@ public interface PetRepository extends Repository<Pet, Integer> {
|
||||||
* @param id the id to search for
|
* @param id the id to search for
|
||||||
* @return the {@link Pet} if found
|
* @return the {@link Pet} if found
|
||||||
*/
|
*/
|
||||||
Pet findById(int id);
|
Pet findById(Integer id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a {@link Pet} to the data store, either inserting or updating it.
|
* Save a {@link Pet} to the data store, either inserting or updating it.
|
||||||
|
|
|
@ -29,8 +29,8 @@ import javax.cache.annotation.CacheResult;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mostly used as a facade for all Petclinic controllers
|
* Mostly used as a facade for all Petclinic controllers Also a placeholder
|
||||||
* Also a placeholder for @Transactional and @CacheResult annotations
|
* for @Transactional and @CacheResult annotations
|
||||||
*
|
*
|
||||||
* @author Michael Isvy
|
* @author Michael Isvy
|
||||||
*/
|
*/
|
||||||
|
@ -43,7 +43,8 @@ public class ClinicServiceImpl implements ClinicService {
|
||||||
private VisitRepository visitRepository;
|
private VisitRepository visitRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ClinicServiceImpl(PetRepository petRepository, VetRepository vetRepository, OwnerRepository ownerRepository, VisitRepository visitRepository) {
|
public ClinicServiceImpl(PetRepository petRepository, VetRepository vetRepository, OwnerRepository ownerRepository,
|
||||||
|
VisitRepository visitRepository) {
|
||||||
this.petRepository = petRepository;
|
this.petRepository = petRepository;
|
||||||
this.vetRepository = vetRepository;
|
this.vetRepository = vetRepository;
|
||||||
this.ownerRepository = ownerRepository;
|
this.ownerRepository = ownerRepository;
|
||||||
|
@ -74,14 +75,12 @@ public class ClinicServiceImpl implements ClinicService {
|
||||||
ownerRepository.save(owner);
|
ownerRepository.save(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void saveVisit(Visit visit) throws DataAccessException {
|
public void saveVisit(Visit visit) throws DataAccessException {
|
||||||
visitRepository.save(visit);
|
visitRepository.save(visit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public Pet findPetById(int id) throws DataAccessException {
|
public Pet findPetById(int id) throws DataAccessException {
|
||||||
|
@ -101,10 +100,9 @@ public class ClinicServiceImpl implements ClinicService {
|
||||||
return vetRepository.findAll();
|
return vetRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Visit> findVisitsByPetId(int petId) {
|
public Collection<Visit> findVisitsByPetId(int petId) {
|
||||||
return visitRepository.findByPetId(petId);
|
return visitRepository.findByPetId(petId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,18 +23,16 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
* Controller used to showcase what happens when an exception is thrown
|
* Controller used to showcase what happens when an exception is thrown
|
||||||
*
|
*
|
||||||
* @author Michael Isvy
|
* @author Michael Isvy
|
||||||
* <p/>
|
* <p/>
|
||||||
* Also see how the bean of type 'SimpleMappingExceptionResolver' has been declared inside
|
* Also see how a view that resolves to "error" has been added ("error.html").
|
||||||
* /WEB-INF/mvc-core-config.xml
|
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class CrashController {
|
public class CrashController {
|
||||||
|
|
||||||
@RequestMapping(value = "/oups", method = RequestMethod.GET)
|
@RequestMapping(value = "/oups", method = RequestMethod.GET)
|
||||||
public String triggerException() {
|
public String triggerException() {
|
||||||
throw new RuntimeException("Expected: controller used to showcase what " +
|
throw new RuntimeException(
|
||||||
"happens when an exception is thrown");
|
"Expected: controller used to showcase what " + "happens when an exception is thrown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2002-2016 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.samples.petclinic.web;
|
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.web.ErrorController;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
public class CustomErrorController implements ErrorController {
|
|
||||||
|
|
||||||
@RequestMapping(value = "/error")
|
|
||||||
public String error() {
|
|
||||||
return "exception";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getErrorPath() {
|
|
||||||
return "/error";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,7 +18,6 @@ package org.springframework.samples.petclinic.web;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.samples.petclinic.model.Vets;
|
import org.springframework.samples.petclinic.model.Vets;
|
||||||
import org.springframework.samples.petclinic.service.ClinicService;
|
import org.springframework.samples.petclinic.service.ClinicService;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
@ -36,32 +35,28 @@ public class VetController {
|
||||||
|
|
||||||
private final ClinicService clinicService;
|
private final ClinicService clinicService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public VetController(ClinicService clinicService) {
|
public VetController(ClinicService clinicService) {
|
||||||
this.clinicService = clinicService;
|
this.clinicService = clinicService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = {"/vets.html"})
|
@RequestMapping(value = { "/vets.html" })
|
||||||
public String showVetList(Map<String, Object> model) {
|
public String showVetList(Map<String, Object> model) {
|
||||||
// Here we are returning an object of type 'Vets' rather than a collection of Vet objects
|
// Here we are returning an object of type 'Vets' rather than a collection of Vet
|
||||||
// so it is simpler for Object-Xml mapping
|
// objects so it is simpler for Object-Xml mapping
|
||||||
Vets vets = new Vets();
|
Vets vets = new Vets();
|
||||||
vets.getVetList().addAll(this.clinicService.findVets());
|
vets.getVetList().addAll(this.clinicService.findVets());
|
||||||
model.put("vets", vets);
|
model.put("vets", vets);
|
||||||
return "vets/vetList";
|
return "vets/vetList";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = {"/vets.json", "/vets.xml"})
|
@RequestMapping(value = { "/vets.json", "/vets.xml" })
|
||||||
public
|
public @ResponseBody Vets showResourcesVetList() {
|
||||||
@ResponseBody
|
// Here we are returning an object of type 'Vets' rather than a collection of Vet
|
||||||
Vets showResourcesVetList() {
|
// objects so it is simpler for JSon/Object mapping
|
||||||
// Here we are returning an object of type 'Vets' rather than a collection of Vet objects
|
|
||||||
// so it is simpler for JSon/Object mapping
|
|
||||||
Vets vets = new Vets();
|
Vets vets = new Vets();
|
||||||
vets.getVetList().addAll(this.clinicService.findVets());
|
vets.getVetList().addAll(this.clinicService.findVets());
|
||||||
return vets;
|
return vets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,10 +89,4 @@ public class VisitController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/owners/*/pets/{petId}/visits", method = RequestMethod.GET)
|
|
||||||
public String showVisits(@PathVariable int petId, Map<String, Object> model) {
|
|
||||||
model.put("visits", this.clinicService.findPetById(petId).getVisits());
|
|
||||||
return "visitList";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
@import "../generated/META-INF/resources/webjars/bootstrap/3.3.6/less/bootstrap.less";
|
@import "META-INF/resources/webjars/bootstrap/3.3.6/less/bootstrap.less";
|
||||||
|
|
||||||
@icon-font-path: "../../webjars/bootstrap/3.3.6/fonts/";
|
@icon-font-path: "../../webjars/bootstrap/fonts/";
|
||||||
|
|
||||||
@spring-green: #6db33f;
|
@spring-green: #6db33f;
|
||||||
@spring-dark-green: #5fa134;
|
@spring-dark-green: #5fa134;
|
|
@ -4,8 +4,7 @@ spring.datasource.schema=classpath*:db/${database}/schema.sql
|
||||||
spring.datasource.data=classpath*:db/${database}/data.sql
|
spring.datasource.data=classpath*:db/${database}/data.sql
|
||||||
|
|
||||||
# Web
|
# Web
|
||||||
spring.mvc.view.prefix=/WEB-INF/jsp/
|
spring.thymeleaf.mode=HTML
|
||||||
spring.mvc.view.suffix=.jsp
|
|
||||||
|
|
||||||
# JPA
|
# JPA
|
||||||
spring.jpa.hibernate.ddl-auto=none
|
spring.jpa.hibernate.ddl-auto=none
|
||||||
|
@ -18,6 +17,7 @@ management.contextPath=/manage
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
logging.level.org.springframework=INFO
|
logging.level.org.springframework=INFO
|
||||||
|
logging.level.org.springframework.web=DEBUG
|
||||||
|
|
||||||
# Active Spring profiles
|
# Active Spring profiles
|
||||||
spring.profiles.active=production
|
spring.profiles.active=production
|
||||||
|
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 362 KiB After Width: | Height: | Size: 362 KiB |
Before Width: | Height: | Size: 528 B After Width: | Height: | Size: 528 B |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
11
src/main/resources/templates/error.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns:th="http://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>
|
26
src/main/resources/templates/fragments/inputField.html
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<form>
|
||||||
|
<th:block th:fragment="input (label, name)">
|
||||||
|
<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">
|
||||||
|
<input class="form-control" type="text"
|
||||||
|
th:field="*{__${name}__}" />
|
||||||
|
<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>
|
94
src/main/resources/templates/fragments/layout.html
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
<!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/favicon.png}">
|
||||||
|
|
||||||
|
<title>PetClinic :: a Spring Framework demonstration</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">
|
||||||
|
|
||||||
|
<li th:fragment="menuItem (path,active,title,glyph,text)" class="active" th:class="${active==menu ? 'active' : ''}">
|
||||||
|
<a th:href="@{__${path}__}" 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>
|
||||||
|
|
||||||
|
<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','th-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">
|
||||||
|
|
||||||
|
<div th:replace="${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>
|
29
src/main/resources/templates/fragments/selectField.html
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<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>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<html xmlns:th="http://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')}" />
|
||||||
|
<input
|
||||||
|
th:replace="~{fragments/inputField :: input ('Last Name', 'lastName')}" />
|
||||||
|
<input
|
||||||
|
th:replace="~{fragments/inputField :: input ('Address', 'address')}" />
|
||||||
|
<input
|
||||||
|
th:replace="~{fragments/inputField :: input ('City', 'city')}" />
|
||||||
|
<input
|
||||||
|
th:replace="~{fragments/inputField :: input ('Telephone', 'telephone')}" />
|
||||||
|
</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>
|
35
src/main/resources/templates/owners/findOwners.html
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<html xmlns:th="http://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="lastName">
|
||||||
|
<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>
|
83
src/main/resources/templates/owners/ownerDetails.html
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns:th="http://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>
|
||||||
|
<a th:href="@{{id}/pets/new(id=${owner.id})}" class="btn btn-default">Add
|
||||||
|
New Pet</a>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<h2>Pets and Visits</h2>
|
||||||
|
|
||||||
|
<table class="table table-striped">
|
||||||
|
|
||||||
|
<tr th:each="pet : ${owner.pets}">
|
||||||
|
<td valign="top">
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
<dt>Name</dt>
|
||||||
|
<dd th:text="${pet.name}" /></dd>
|
||||||
|
<dt>Birth Date</dt>
|
||||||
|
<dd
|
||||||
|
th:text="${#calendars.format(pet.birthDate, 'yyyy-MM-dd')}" /></dd>
|
||||||
|
<dt>Type</dt>
|
||||||
|
<dd th:text="${pet.type}" /></dd>
|
||||||
|
</dl>
|
||||||
|
</td>
|
||||||
|
<td valign="top">
|
||||||
|
<table class="table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Visit Date</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tr th:each="visit : ${pet.visits}">
|
||||||
|
<td th:text="${#calendars.format(visit.date, 'yyyy-MM-dd')}"></td>
|
||||||
|
<td th:text="${visit?.description}"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><a
|
||||||
|
th:href="@{{ownerId}/pets/{petId}/edit(ownerId=${owner.id},petId=${pet.id})}">Edit
|
||||||
|
Pet</a></td>
|
||||||
|
<td><a
|
||||||
|
th:href="@{{ownerId}/pets/{petId}/visits/new(ownerId=${owner.id},petId=${pet.id})}">Add
|
||||||
|
Visit</a></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
33
src/main/resources/templates/owners/ownersList.html
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<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}"/>
|
||||||
|
<td><span th:each="pet : ${owner.pets}" th:text="${pet.name} "/></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
38
src/main/resources/templates/pets/createOrUpdatePetForm.html
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org"
|
||||||
|
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
<th:block th:if="${pet['new']}">New </th:block>
|
||||||
|
Pet
|
||||||
|
</h2>
|
||||||
|
<form th:object="${pet}" class="form-horizontal" method="post">
|
||||||
|
<input type="hidden" name="id" th:value="*{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">
|
||||||
|
<span th:text="${pet.owner?.firstName + ' ' + pet.owner?.lastName}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
th:replace="~{fragments/inputField :: input ('Name', 'name')}" />
|
||||||
|
<input
|
||||||
|
th:replace="~{fragments/inputField :: input ('Birth Date', 'birthDate')}" />
|
||||||
|
<input
|
||||||
|
th:replace="~{fragments/selectField :: select ('Type', 'type', ${types})}" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<button
|
||||||
|
th:with="text=${owner['new']} ? 'Add Pet' : 'Update Pet'"
|
||||||
|
class="btn btn-default" type="submit" th:text="${text}">Add
|
||||||
|
Pet</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -0,0 +1,61 @@
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org"
|
||||||
|
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
<th:block th:if="${visit['new']}">New </th:block>
|
||||||
|
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 th:text="${visit.pet.name}" /></td>
|
||||||
|
<td
|
||||||
|
th:text="${#calendars.format(visit.pet.birthDate, 'yyyy-MM-dd')}" /></td>
|
||||||
|
<td th:text="${visit.pet.type}" /></td>
|
||||||
|
<td
|
||||||
|
th:text="${visit.pet.owner?.firstName + ' ' + visit.pet.owner?.lastName}" /></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<form th:object="${visit}" class="form-horizontal" method="post">
|
||||||
|
<div class="form-group has-feedback">
|
||||||
|
<input
|
||||||
|
th:replace="~{fragments/inputField :: input ('Date', 'date')}" />
|
||||||
|
<input
|
||||||
|
th:replace="~{fragments/inputField :: input ('Description', 'description')}" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<input type="hidden" name="petId" th:value="${visit.pet.id}" />
|
||||||
|
<button class="btn btn-default" type="submit">Add Visit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<b>Previous Visits</b>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<tr>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr th:if="${!visit['new']}" th:each="visit : ${visit.pet.visits}">
|
||||||
|
<td th:text="${#calendars.format(visit.date, 'yyyy-MM-dd')}" /></td>
|
||||||
|
<td th:text=" ${visit.description}" /></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
36
src/main/resources/templates/vets/vetList.html
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<!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>
|
16
src/main/resources/templates/welcome.html
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<!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>
|
|
@ -1,7 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,14 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,34 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,34 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,98 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,48 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,51 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,70 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,44 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,14 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<%@ 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}"/>
|
|
|
@ -1,15 +0,0 @@
|
||||||
<%@ 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>
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,26 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,27 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,45 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<%@ 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>
|
|
|
@ -1,30 +0,0 @@
|
||||||
<%@ 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>
|
|
4
src/main/webapp/bower_components/bower.json
vendored
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"name": "spring-petclinic",
|
|
||||||
"dependencies": {}
|
|
||||||
}
|
|
1
src/main/webapp/resources/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
generated
|
|
|
@ -65,13 +65,4 @@ public class VisitControllerTests {
|
||||||
.andExpect(view().name("pets/createOrUpdateVisitForm"));
|
.andExpect(view().name("pets/createOrUpdateVisitForm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testShowVisits() throws Exception {
|
|
||||||
mockMvc.perform(get("/owners/*/pets/{petId}/visits", TEST_PET_ID))
|
|
||||||
.andExpect(status().isOk())
|
|
||||||
.andExpect(model().attributeExists("visits"))
|
|
||||||
.andExpect(view().name("visitList"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|