petclinic-aplcache
Changes
src/main/resources/log4j.xml 15(+0 -15)
src/main/webapp/WEB-INF/petclinic-servlet.xml 20(+10 -10)
Details
diff --git a/src/main/java/org/springframework/samples/petclinic/Pet.java b/src/main/java/org/springframework/samples/petclinic/Pet.java
index 6235ba9..8974bae 100644
--- a/src/main/java/org/springframework/samples/petclinic/Pet.java
+++ b/src/main/java/org/springframework/samples/petclinic/Pet.java
@@ -19,6 +19,7 @@ import org.hibernate.annotations.Type;
import org.joda.time.DateTime;
import org.springframework.beans.support.MutableSortDefinition;
import org.springframework.beans.support.PropertyComparator;
+import org.springframework.format.annotation.DateTimeFormat;
/**
* Simple JavaBean business object representing a pet.
@@ -32,6 +33,7 @@ public class Pet extends NamedEntity {
@Column(name="birth_date")
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
+ @DateTimeFormat(pattern="yyyy/MM/dd")
private DateTime birthDate;
@ManyToOne
src/main/resources/log4j.xml 15(+0 -15)
diff --git a/src/main/resources/log4j.xml b/src/main/resources/log4j.xml
index 4050665..c39d78d 100755
--- a/src/main/resources/log4j.xml
+++ b/src/main/resources/log4j.xml
@@ -11,21 +11,6 @@
</layout>
</appender>
- <logger name="org.springframework.web">
- <level value="debug" />
- </logger>
-
- <logger name="org.springframework.jdbc">
- <level value="info" />
- </logger>
-
- <logger name="javax.validation">
- <level value="debug" />
- </logger>
-
- <logger name="org.hibernate.validator">
- <level value="debug" />
- </logger>
<!-- Root Logger -->
<root>
diff --git a/src/main/webapp/WEB-INF/jsp/pets/createOrUpdatePetForm.jsp b/src/main/webapp/WEB-INF/jsp/pets/createOrUpdatePetForm.jsp
index b118a6f..80042ee 100644
--- a/src/main/webapp/WEB-INF/jsp/pets/createOrUpdatePetForm.jsp
+++ b/src/main/webapp/WEB-INF/jsp/pets/createOrUpdatePetForm.jsp
@@ -10,7 +10,7 @@
<script>
$(function() {
- $("#birthDate").datepicker();
+ $("#birthDate").datepicker({ dateFormat: 'yy/mm/dd'});
});
</script>
<div class="container">
@@ -44,7 +44,7 @@
</div>
</div>
<div class="control-group">
- <label class="control-label">Birth Date (yyyy-MM-dd)</label>
+ <label class="control-label">Birth Date</label>
<div class="controls">
<form:input path="birthDate" />
<span class="help-inline"><form:errors path="birthDate" /></span>
src/main/webapp/WEB-INF/petclinic-servlet.xml 20(+10 -10)
diff --git a/src/main/webapp/WEB-INF/petclinic-servlet.xml b/src/main/webapp/WEB-INF/petclinic-servlet.xml
index dbb255a..485b73d 100644
--- a/src/main/webapp/WEB-INF/petclinic-servlet.xml
+++ b/src/main/webapp/WEB-INF/petclinic-servlet.xml
@@ -16,7 +16,7 @@
<context:component-scan base-package="org.springframework.samples.petclinic.web, org.springframework.samples.petclinic.service"/>
- <mvc:annotation-driven />
+ <mvc:annotation-driven conversion-service="conversionService"/>
<!-- all resources inside folder src/main/webapp/resources are mapped so they can be refered to inside JSP files
(see header.jsp for more details) -->
@@ -28,6 +28,15 @@
<mvc:view-controller path="/" view-name="welcome"/>
+ <bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
+ <property name="formatters">
+ <set>
+ <bean class="org.springframework.samples.petclinic.web.PetTypeFormatter" />
+ </set>
+ </property>
+ </bean>
+
+
<!--
- This view resolver delegates to the InternalResourceViewResolver and BeanNameViewResolver,
- and uses the requested media type to pick a matching view. When the media type is 'text/html',
@@ -76,15 +85,6 @@
-->
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"
p:basename="messages/messages"/>
-
- <!--
- Processes annotated handler methods, applying PetClinic-specific request parameter binding.
- -->
- <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
- <property name="webBindingInitializer">
- <bean class="org.springframework.samples.petclinic.web.ClinicBindingInitializer"/>
- </property>
- </bean>
<!--
- This bean resolves specific types of exceptions to corresponding logical