This commit is contained in:
Xiao Xi LIU 2015-05-29 07:16:42 +00:00
commit 2507a9ce47
13 changed files with 219 additions and 87 deletions

View file

@ -0,0 +1,3 @@
global.i18n.msg.processing=\u6b63\u5728\u5904\u7406\u4e2d...
global.i18n.msg.search=\u641c\u7d22 :
global.i18n.msg.info=\u81ea _START_ \u81f3 _END_ , \u5171 _TOTAL_ \u6761

View file

@ -6,3 +6,51 @@ nonNumeric=must be all numeric
duplicateFormSubmission=Duplicate form submission is not allowed
typeMismatch.date=invalid date
typeMismatch.birthDate=invalid date
home=Home
findOwners=Find owners
veterinarians=Veterinarians
error=Error
new=New
errorTitle=trigger a RuntimeException to see how it is handled
somethingHappened=Something happened...
owner=Owner
addOwner=Add Owner
updateOwner=Update Owner
editOwner=Edit Owner
lastName=Last name
firstName=First name
findOwner=Find Owner
ownerInformation=Owner Information
name=Name
address=Address
city=City
telephone=Telephone
addNewPet=Add New Pet
addPet=Add Pet
updatePet=Update Pet
editPet=Edit Pet
addVisit=Add Visit
petName=Name
petsAndVisits=Pets and Visits
birthDate=Birth Date
type=Type
visitDate=Visit Date
description=Description
owners=Owners
pets=Pets
pet=Pet
visit=Visit
addVisit=Add Visit
previousVisits=Previous Visits
date=Date
viewAsXml=View as XML
viewAsJson=View as JSon
specialties=Specialties

View file

@ -0,0 +1,56 @@
welcome=\u6b22\u8fce\u6765\u5230\u5ba0\u7269\u8bca\u6240
required=\u5fc5\u586b\u9879
notFound=\u672a\u627e\u5230
duplicate=\u5df2\u7528
nonNumeric=\u5fc5\u987b\u4e3a\u6570\u5b57
duplicateFormSubmission=\u4e0d\u53ef\u91cd\u590d\u63d0\u4ea4
typeMismatch.date=\u65e0\u6548\u65e5\u671f
typeMismatch.birthDate=\u65e0\u6548\u65e5\u671f
home=\u4e3b\u9875
findOwners=\u67e5\u627e\u4e3b\u4eba
veterinarians=\u5ba0\u7269\u533b\u751f
error=\u9519\u8bef\u6d88\u606f
new=\u65b0\u5efa
errorTitle=\u89e6\u53d1\u4e00\u4e2a RuntimeException\u5f02\u5e38\uff0c\u89c2\u5bdf\u5176\u5904\u7406\u903b\u8f91
somethingHappened=\u51fa\u4e86\u4e9b\u72b6\u51b5...
owner=\u4e3b\u4eba
addOwner=\u65b0\u589e\u4e3b\u4eba
updateOwner=\u66f4\u65b0\u4e3b\u4eba
editOwner=\u7f16\u8f91\u4e3b\u4eba
lastName=\u59d3
firstName=\u540d
findOwner=\u5bfb\u627e\u4e3b\u4eba
ownerInformation=\u4e3b\u4eba\u4fe1\u606f
name=\u59d3\u540d
address=\u5730\u5740
city=\u57ce\u5e02
telephone=\u7535\u8bdd
addNewPet=\u65b0\u589e\u5ba0\u7269
addPet=\u589e\u52a0\u5ba0\u7269
updatePet=\u66f4\u65b0\u5ba0\u7269
editPet=\u7f16\u8f91\u5ba0\u7269
addVisit=\u65b0\u589e\u5c31\u8bca\u8bb0\u5f55
petName=\u540d\u79f0
petsAndVisits=\u5ba0\u7269\u548c\u5c31\u8bca\u8bb0\u5f55
birthDate=\u751f\u65e5
type=\u79cd\u7c7b
visitDate=\u5c31\u8bca\u65e5\u671f
description=\u63cf\u8ff0
owners=\u4e3b\u4eba
pets=\u5ba0\u7269
pet=\u5ba0\u7269
visit=\u5c31\u8bca\u8bb0\u5f55
addVisit=\u65b0\u589e\u5c31\u8bca\u8bb0\u5f55
previousVisits=\u4e4b\u524d\u7684\u5c31\u8bca\u8bb0\u5f55
date=\u65e5\u671f
viewAsXml=XML\u89c6\u56fe
viewAsJson=JSON\u89c6\u56fe
specialties=\u4e13\u957f

View file

@ -2,6 +2,7 @@
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html lang="en">
<jsp:include page="fragments/staticFiles.jsp"/>
@ -12,7 +13,7 @@
<spring:url value="/resources/images/pets.png" var="petsImage"/>
<img src="${petsImage}"/>
<h2>Something happened...</h2>
<h2><fmt:message key="somethingHappened"/></h2>
<p>${exception.message}</p>

View file

@ -8,14 +8,14 @@
<div class="navbar-inner">
<ul class="nav">
<li style="width: 120px;"><a href="<spring:url value="/" htmlEscape="true" />"><i class="icon-home"></i>
Home</a></li>
<li style="width: 150px;"><a href="<spring:url value="/owners/find.html" htmlEscape="true" />"><i
class="icon-search"></i> Find owners</a></li>
<li style="width: 160px;"><a href="<spring:url value="/vets.html" htmlEscape="true" />"><i
class="icon-th-list"></i> Veterinarians</a></li>
<li style="width: 110px;"><a href="<spring:url value="/oups.html" htmlEscape="true" />"
title="trigger a RuntimeException to see how it is handled"><i
class="icon-warning-sign"></i> Error</a></li>
<fmt:message key="home"/></a></li>
<li style="width: 150px;"><a href="<spring:url value='/owners/find.html' htmlEscape='true' />"><i
class="icon-search"></i> <fmt:message key="findOwners"/></a></li>
<li style="width: 160px;"><a href="<spring:url value='/vets.html' htmlEscape='true' />"><i
class="icon-th-list"></i> <fmt:message key="veterinarians"/> </a></li>
<li style="width: 110px;"><a href="<spring:url value='/oups.html' htmlEscape='true' />"
title="<fmt:message key='errorTitle'/>"><i
class="icon-warning-sign"></i> <fmt:message key="error"/> </a></li>
</ul>
</div>
</div>

View file

@ -21,22 +21,29 @@
</c:choose>
<h2>
<c:if test="${owner['new']}">New </c:if> Owner
<c:if test="${owner['new']}"><fmt:message key="new"/> </c:if> <fmt:message key="owner"/>
</h2>
<spring:message code="firstName" var="firstName" />
<spring:message code="lastName" var="lastName" />
<spring:message code="address" var="Address" />
<spring:message code="city" var="City" />
<spring:message code="telephone" var="Telephone" />
<form:form modelAttribute="owner" method="${method}" class="form-horizontal" id="add-owner-form">
<petclinic:inputField label="First Name" name="firstName"/>
<petclinic:inputField label="Last Name" name="lastName"/>
<petclinic:inputField label="Address" name="address"/>
<petclinic:inputField label="City" name="city"/>
<petclinic:inputField label="Telephone" name="telephone"/>
<petclinic:inputField label="${firstName}" name="firstName"/>
<petclinic:inputField label="${lastName}" name="lastName"/>
<petclinic:inputField label="${Address}" name="address"/>
<petclinic:inputField label="${City}" name="city"/>
<petclinic:inputField label="${Telephone}" name="telephone"/>
<div class="form-actions">
<c:choose>
<c:when test="${owner['new']}">
<button type="submit">Add Owner</button>
<button type="submit"><fmt:message key="addOwner"/></button>
</c:when>
<c:otherwise>
<button type="submit">Update Owner</button>
<button type="submit"><fmt:message key="updateOwner"/></button>
</c:otherwise>
</c:choose>
</div>

View file

@ -13,25 +13,25 @@
<div class="container">
<jsp:include page="../fragments/bodyHeader.jsp"/>
<h2>Find Owners</h2>
<h2><fmt:message key="findOwners"/></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">
<fieldset>
<div class="control-group" id="lastName">
<label class="control-label">Last name </label>
<label class="control-label"><fmt:message key="lastName"/> </label>
<form:input path="lastName" size="30" maxlength="80"/>
<span class="help-inline"><form:errors path="*"/></span>
</div>
<div class="form-actions">
<button type="submit">Find Owner</button>
<button type="submit"><fmt:message key="findOwner"/></button>
</div>
</fieldset>
</form:form>
<br/>
<a href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
<a href='<spring:url value="/owners/new" htmlEscape="true"/>'><fmt:message key="addOwner"/></a>
<jsp:include page="../fragments/footer.jsp"/>

View file

@ -14,23 +14,23 @@
<div class="container">
<jsp:include page="../fragments/bodyHeader.jsp"/>
<h2>Owner Information</h2>
<h2><fmt:message key="ownerInformation"/></h2>
<table class="table table-striped" style="width:600px;">
<tr>
<th>Name</th>
<th><fmt:message key="name"/></th>
<td><b><c:out value="${owner.firstName} ${owner.lastName}"/></b></td>
</tr>
<tr>
<th>Address</th>
<th><fmt:message key="address"/></th>
<td><c:out value="${owner.address}"/></td>
</tr>
<tr>
<th>City</th>
<th><fmt:message key="city"/></th>
<td><c:out value="${owner.city}"/></td>
</tr>
<tr>
<th>Telephone</th>
<th><fmt:message key="telephone"/></th>
<td><c:out value="${owner.telephone}"/></td>
</tr>
<tr>
@ -38,27 +38,27 @@
<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-info">Edit Owner</a></td>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-info"><fmt:message key="editOwner"/></a></td>
<td>
<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-success">Add New Pet</a></td>
<a href="${fn:escapeXml(addUrl)}" class="btn btn-success"><fmt:message key="addNewPet"/></a></td>
</tr>
</table>
<h2>Pets and Visits</h2>
<h2><fmt:message key="petsAndVisits"/></h2>
<c:forEach var="pet" items="${owner.pets}">
<table class="table" style="width:600px;">
<tr>
<td valign="top" style="width: 120px;">
<dl class="dl-horizontal">
<dt>Name</dt>
<dt><fmt:message key="petName"/></dt>
<dd><c:out value="${pet.name}"/></dd>
<dt>Birth Date</dt>
<dt><fmt:message key="birthDate"/></dt>
<dd><joda:format value="${pet.birthDate}" pattern="yyyy-MM-dd"/></dd>
<dt>Type</dt>
<dt><fmt:message key="type"/></dt>
<dd><c:out value="${pet.type.name}"/></dd>
</dl>
</td>
@ -66,8 +66,8 @@
<table class="table-condensed">
<thead>
<tr>
<th>Visit Date</th>
<th>Description</th>
<th><fmt:message key="visitDate"/></th>
<th><fmt:message key="description"/></th>
</tr>
</thead>
<c:forEach var="visit" items="${pet.visits}">
@ -82,14 +82,14 @@
<spring:param name="ownerId" value="${owner.id}"/>
<spring:param name="petId" value="${pet.id}"/>
</spring:url>
<a href="${fn:escapeXml(petUrl)}">Edit Pet</a>
<a href="${fn:escapeXml(petUrl)}"><fmt:message key="editPet"/></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>
<a href="${fn:escapeXml(visitUrl)}"><fmt:message key="addVisit"/></a>
</td>
</tr>
</table>

View file

@ -13,23 +13,29 @@
<body>
<div class="container">
<jsp:include page="../fragments/bodyHeader.jsp"/>
<h2>Owners</h2>
<h2><fmt:message key="owners"/></h2>
<spring:message code="name" var="Name" />
<spring:message code="address" var="Address" />
<spring:message code="city" var="City" />
<spring:message code="telephone" var="Telephone" />
<spring:message code="pets" var="Pets" />
<datatables:table id="owners" data="${selections}" row="owner" theme="bootstrap2"
cssClass="table table-striped" pageable="false" info="false" export="pdf">
<datatables:column title="Name" cssStyle="width: 150px;" display="html">
<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">
<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;">
<datatables:column title="${Address}" property="address" cssStyle="width: 200px;"/>
<datatables:column title="${City}" property="city"/>
<datatables:column title="${Telephone}" xtitlekey="telephone" property="telephone"/>
<datatables:column title="${Pets}" xtitlekey="pets" cssStyle="width: 100px;">
<c:forEach var="pet" items="${owner.pets}">
<c:out value="${pet.name}"/>
</c:forEach>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<%@ 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="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
@ -28,29 +29,33 @@
</c:choose>
<h2>
<c:if test="${pet['new']}">New </c:if>
Pet
<c:if test="${pet['new']}"><fmt:message key="new"/> </c:if>
<fmt:message key="pet"/>
</h2>
<spring:message code="petName" var="Name" />
<spring:message code="birthDate" var="BirthDate" />
<spring:message code="type" var="Type" />
<form:form modelAttribute="pet" method="${method}"
class="form-horizontal">
<div class="control-group" id="owner">
<label class="control-label">Owner </label>
<label class="control-label"><fmt:message key="owner"/> </label>
<c:out value="${pet.owner.firstName} ${pet.owner.lastName}"/>
</div>
<petclinic:inputField label="Name" name="name"/>
<petclinic:inputField label="Birth Date" name="birthDate"/>
<petclinic:inputField label="${Name}" name="name"/>
<petclinic:inputField label="${BirthDate}" name="birthDate"/>
<div class="control-group">
<petclinic:selectField name="type" label="Type " names="${types}" size="5"/>
<petclinic:selectField name="type" label="${Type} " names="${types}" size="5"/>
</div>
<div class="form-actions">
<c:choose>
<c:when test="${pet['new']}">
<button type="submit">Add Pet</button>
<button type="submit"><fmt:message key="addPet"/></button>
</c:when>
<c:otherwise>
<button type="submit">Update Pet</button>
<button type="submit"><fmt:message key="updatePet"/></button>
</c:otherwise>
</c:choose>
</div>

View file

@ -21,16 +21,16 @@
</script>
<div class="container">
<jsp:include page="../fragments/bodyHeader.jsp"/>
<h2><c:if test="${visit['new']}">New </c:if>Visit</h2>
<h2><c:if test="${visit['new']}"><fmt:message key="new"/> </c:if><fmt:message key="visit"/></h2>
<b>Pet</b>
<b><fmt:message key="pet"/></b>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Birth Date</th>
<th>Type</th>
<th>Owner</th>
<th><fmt:message key="name"/></th>
<th><fmt:message key="birthDate"/></th>
<th><fmt:message key="type"/></th>
<th><fmt:message key="owner"/></th>
</tr>
</thead>
<tr>
@ -40,24 +40,27 @@
<td><c:out value="${visit.pet.owner.firstName} ${visit.pet.owner.lastName}"/></td>
</tr>
</table>
<spring:message code="date" var="date" />
<spring:message code="description" var="description" />
<form:form modelAttribute="visit">
<petclinic:inputField label="date" name="date" />
<petclinic:inputField label="description" name="description" />
<petclinic:inputField label="${date}" name="date" />
<petclinic:inputField label="${description}" name="description" />
<div class="form-actions">
<input type="hidden" name="petId" value="${visit.pet.id}"/>
<button type="submit">Add Visit</button>
<button type="submit"><fmt:message key="addVisit"/></button>
</div>
</form:form>
<br/>
<b>Previous Visits</b>
<b><fmt:message key="previousVisits"/></b>
<table style="width: 333px;">
<tr>
<th>Date</th>
<th>Description</th>
<th><fmt:message key="visit"/><fmt:message key="date"/></th>
<th><fmt:message key="visit"/><fmt:message key="description"/></th>
</tr>
<c:forEach var="visit" items="${visit.pet.visits}">
<c:if test="${!visit['new']}">

View file

@ -14,13 +14,16 @@
<div class="container">
<jsp:include page="../fragments/bodyHeader.jsp"/>
<h2>Veterinarians</h2>
<h2><fmt:message key="veterinarians"/></h2>
<spring:message code="name" var="Name" />
<spring:message code="specialties" var="Specialties" />
<datatables:table id="vets" data="${vets.vetList}" row="vet" theme="bootstrap2" cssClass="table table-striped" pageable="false" info="false">
<datatables:column title="Name">
<datatables:column title="${Name}">
<c:out value="${vet.firstName} ${vet.lastName}"></c:out>
</datatables:column>
<datatables:column title="Specialties">
<datatables:column title="${Specialties}">
<c:forEach var="specialty" items="${vet.specialties}">
<c:out value="${specialty.name}"/>
</c:forEach>
@ -31,10 +34,10 @@
<table class="table-buttons">
<tr>
<td>
<a href="<spring:url value="/vets.xml" htmlEscape="true" />">View as XML</a>
<a href="<spring:url value="/vets.xml" htmlEscape="true" />"><fmt:message key="viewAsXml"/></a>
</td>
<td>
<a href="<spring:url value="/vets.json" htmlEscape="true" />">View as JSon</a>
<a href="<spring:url value="/vets.json" htmlEscape="true" />"><fmt:message key="viewAsJson"/></a>
</td>
</tr>
</table>

View file

@ -69,6 +69,25 @@ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
<url-pattern>/dandelion-assets/*</url-pattern>
</servlet-mapping>
<!-- used to provide the ability to enter Chinese characters inside the Owner Form -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Dandelion filter definition and mapping -->
<filter>
<filter-name>dandelionFilter</filter-name>
@ -92,25 +111,6 @@ see here: http://static.springsource.org/spring/docs/current/spring-framework-re
<servlet-name>petclinic</servlet-name>
</filter-mapping>
<!-- used to provide the ability to enter Chinese characters inside the Owner Form -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Dandelion-Datatables filter, used for basic export -->
<filter>
<filter-name>datatables</filter-name>