mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:25:50 +00:00
Merge pull request #3 from tduchateau/master
Added Dandelion-Datatables
This commit is contained in:
commit
3d9a37fe70
4 changed files with 146 additions and 119 deletions
23
pom.xml
23
pom.xml
|
@ -47,7 +47,10 @@
|
|||
<webjars-bootstrap.version>2.3.0</webjars-bootstrap.version>
|
||||
<webjars-jquery-ui.version>1.9.2</webjars-jquery-ui.version>
|
||||
<webjars-jquery.version>1.9.0</webjars-jquery.version>
|
||||
|
||||
<dandelion.datatables.version>0.8.5</dandelion.datatables.version>
|
||||
<dandelion.datatables.export.itext.version>0.1.5</dandelion.datatables.export.itext.version>
|
||||
<dandelion.datatables.servlet2.version>0.1.4</dandelion.datatables.servlet2.version>
|
||||
|
||||
<maven-assembly-plugin.version>2.4</maven-assembly-plugin.version>
|
||||
<maven-clean-plugin.version>2.5</maven-clean-plugin.version>
|
||||
<maven-compiler-plugin.version>3.0</maven-compiler-plugin.version>
|
||||
|
@ -234,7 +237,23 @@
|
|||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<!-- Dandelion -->
|
||||
<dependency>
|
||||
<groupId>com.github.dandelion</groupId>
|
||||
<artifactId>datatables-jsp</artifactId>
|
||||
<version>${dandelion.datatables.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.dandelion</groupId>
|
||||
<artifactId>datatables-export-itext</artifactId>
|
||||
<version>${dandelion.datatables.export.itext.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.dandelion</groupId>
|
||||
<artifactId>datatables-servlet2</artifactId>
|
||||
<version>${dandelion.datatables.servlet2.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- all Maven plugin versions are mentioned in order to guarantee the build reproducibility in the long term -->
|
||||
<build>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<%@ 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="datatables" uri="http://github.com/dandelion/datatables" %>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
|
@ -12,36 +12,29 @@
|
|||
<div class="container">
|
||||
<jsp:include page="../fragments/bodyHeader.jsp"/>
|
||||
<h2>Owners</h2>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 150px;">Name</th>
|
||||
<th style="width: 200px;">Address</th>
|
||||
<th>City</th>
|
||||
<th>Telephone</th>
|
||||
<th style="width: 100px;">Pets</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<c:forEach var="owner" items="${selections}">
|
||||
<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>
|
||||
</table>
|
||||
|
||||
<datatables:table id="owners" data="${selections}" cdn="true" row="owner" theme="bootstrap2"
|
||||
cssClass="table table-striped" paginate="false" info="false" export="pdf">
|
||||
<datatables:column title="Name" cssStyle="width: 150px;" display="html">
|
||||
<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>
|
||||
</datatables:column>
|
||||
<datatables:column title="Name" display="pdf">
|
||||
<c:out value="${owner.firstName} ${owner.lastName}"/>
|
||||
</datatables:column>
|
||||
<datatables:column title="Address" property="address" cssStyle="width: 200px;"/>
|
||||
<datatables:column title="City" property="city"/>
|
||||
<datatables:column title="Telephone" property="telephone"/>
|
||||
<datatables:column title="Pets" cssStyle="width: 100px;">
|
||||
<c:forEach var="pet" items="${owner.pets}">
|
||||
<c:out value="${pet.name}"/>
|
||||
</c:forEach>
|
||||
</datatables:column>
|
||||
<datatables:export type="pdf" cssClass="btn btn-small" />
|
||||
</datatables:table>
|
||||
|
||||
<jsp:include page="../fragments/footer.jsp"/>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%@ 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="datatables" uri="http://github.com/dandelion/datatables" %>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
|
@ -14,27 +14,18 @@
|
|||
|
||||
<h2>Veterinarians</h2>
|
||||
|
||||
<table class="table table-stripped" style="width:600px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Specialties</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach var="vet" items="${vets.vetList}">
|
||||
<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>
|
||||
<datatables:table id="vets" data="${vets.vetList}" cdn="true" row="vet" theme="bootstrap2" cssClass="table table-striped" paginate="false" info="false">
|
||||
<datatables:column title="Name">
|
||||
<c:out value="${vet.firstName} ${vet.lastName}"></c:out>
|
||||
</datatables:column>
|
||||
<datatables:column title="Specialties">
|
||||
<c:forEach var="specialty" items="${vet.specialties}">
|
||||
<c:out value="${specialty.name}"/>
|
||||
</c:forEach>
|
||||
<c:if test="${vet.nrOfSpecialties == 0}">none</c:if>
|
||||
</datatables:column>
|
||||
</datatables:table>
|
||||
|
||||
<table class="table-buttons">
|
||||
<tr>
|
||||
<td>
|
||||
|
|
|
@ -1,65 +1,89 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
id="WebApp_ID" version="2.5">
|
||||
|
||||
<display-name>Spring PetClinic</display-name>
|
||||
<description>Spring PetClinic sample application</description>
|
||||
|
||||
<context-param>
|
||||
<param-name>spring.profiles.active</param-name>
|
||||
<param-value>jdbc</param-value>
|
||||
<!-- Available profiles:
|
||||
<param-value>jdbc</param-value>
|
||||
<param-value>jpa</param-value> (in the case of plain JPA)
|
||||
<param-value>spring-data-jpa</param-value> (in the case of Spring Data JPA)
|
||||
-->
|
||||
</context-param>
|
||||
|
||||
<!--
|
||||
- Location of the XML file that defines the root application context.
|
||||
- Applied by ContextLoaderServlet.
|
||||
-->
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:spring/dao-config.xml, classpath:spring/tools-config.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!--
|
||||
- Servlet that dispatches request to registered handlers (Controller implementations).
|
||||
-->
|
||||
<servlet>
|
||||
<servlet-name>petclinic</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:spring/mvc-core-config.xml</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>petclinic</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- used so we can use forms of method type 'PUT' and 'DELETE'
|
||||
see here: http://static.springsource.org/spring/docs/current/spring-framework-reference/html/view.html#rest-method-conversion
|
||||
-->
|
||||
<filter>
|
||||
<filter-name>httpMethodFilter</filter-name>
|
||||
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>httpMethodFilter</filter-name>
|
||||
<servlet-name>petclinic</servlet-name>
|
||||
</filter-mapping>
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
id="WebApp_ID" version="2.5">
|
||||
|
||||
<display-name>Spring PetClinic</display-name>
|
||||
<description>Spring PetClinic sample application</description>
|
||||
|
||||
<context-param>
|
||||
<param-name>spring.profiles.active</param-name>
|
||||
<param-value>jdbc</param-value>
|
||||
<!-- Available profiles:
|
||||
<param-value>jdbc</param-value>
|
||||
<param-value>jpa</param-value> (in the case of plain JPA)
|
||||
<param-value>spring-data-jpa</param-value> (in the case of Spring Data JPA)
|
||||
-->
|
||||
</context-param>
|
||||
|
||||
<!--
|
||||
- Location of the XML file that defines the root application context.
|
||||
- Applied by ContextLoaderServlet.
|
||||
-->
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:spring/dao-config.xml, classpath:spring/tools-config.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!--
|
||||
- Servlet that dispatches request to registered handlers (Controller implementations).
|
||||
-->
|
||||
<servlet>
|
||||
<servlet-name>petclinic</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:spring/mvc-core-config.xml</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>petclinic</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Dandelion-Datatables servlet definition -->
|
||||
<servlet>
|
||||
<servlet-name>datatablesController</servlet-name>
|
||||
<servlet-class>com.github.dandelion.datatables.extras.servlet2.servlet.DatatablesServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<!-- Dandelion-Datatables servlet mapping -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>datatablesController</servlet-name>
|
||||
<url-pattern>/datatablesController/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Dandelion-Datatables filter definition -->
|
||||
<filter>
|
||||
<filter-name>datatablesFilter</filter-name>
|
||||
<filter-class>com.github.dandelion.datatables.extras.servlet2.filter.DatatablesFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<!-- Dandelion-Datatables filter mapping -->
|
||||
<filter-mapping>
|
||||
<filter-name>datatablesFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- used so we can use forms of method type 'PUT' and 'DELETE'
|
||||
see here: http://static.springsource.org/spring/docs/current/spring-framework-reference/html/view.html#rest-method-conversion
|
||||
-->
|
||||
<filter>
|
||||
<filter-name>httpMethodFilter</filter-name>
|
||||
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>httpMethodFilter</filter-name>
|
||||
<servlet-name>petclinic</servlet-name>
|
||||
</filter-mapping>
|
||||
|
||||
</web-app>
|
Loading…
Reference in a new issue