From 0e60b03708f7a9bcfcaaff1359cf223c754500f7 Mon Sep 17 00:00:00 2001
From: Mic <misvy@vmware.com>
Date: Thu, 7 Feb 2013 10:31:18 +0800
Subject: [PATCH] fixed naming issue in vet list

---
 src/main/java/org/springframework/samples/petclinic/Vet.java  | 4 +++-
 .../springframework/samples/petclinic/web/VetController.java  | 2 +-
 .../webapp/WEB-INF/jsp/vets/{vetsList.jsp => vetList.jsp}     | 4 ++--
 src/main/webapp/WEB-INF/mvc-view-config.xml                   | 2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)
 rename src/main/webapp/WEB-INF/jsp/vets/{vetsList.jsp => vetList.jsp} (90%)

diff --git a/src/main/java/org/springframework/samples/petclinic/Vet.java b/src/main/java/org/springframework/samples/petclinic/Vet.java
index 5ef56fe..744288b 100644
--- a/src/main/java/org/springframework/samples/petclinic/Vet.java
+++ b/src/main/java/org/springframework/samples/petclinic/Vet.java
@@ -7,6 +7,7 @@ import java.util.List;
 import java.util.Set;
 
 import javax.persistence.Entity;
+import javax.persistence.FetchType;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
 import javax.persistence.ManyToMany;
@@ -27,7 +28,8 @@ import org.springframework.beans.support.PropertyComparator;
 @Entity @Table(name="vets")
 public class Vet extends Person {
 
-	@ManyToMany @JoinTable (name="vet_specialties",joinColumns = @JoinColumn(name = "vet_id"), 
+	@ManyToMany(fetch=FetchType.EAGER) 
+	@JoinTable (name="vet_specialties",joinColumns = @JoinColumn(name = "vet_id"), 
 										inverseJoinColumns= @JoinColumn(name = "specialty_id"))
 	private Set<Specialty> specialties;
 
diff --git a/src/main/java/org/springframework/samples/petclinic/web/VetController.java b/src/main/java/org/springframework/samples/petclinic/web/VetController.java
index 07bcaaa..50cefc7 100644
--- a/src/main/java/org/springframework/samples/petclinic/web/VetController.java
+++ b/src/main/java/org/springframework/samples/petclinic/web/VetController.java
@@ -44,7 +44,7 @@ public class VetController {
 		Vets vets = new Vets();
 		vets.getVetList().addAll(this.clinicService.findVets());
 		model.addAttribute("vets", vets);
-		return "vets/vetsList";
+		return "vets/vetList";
 	}
 
 
diff --git a/src/main/webapp/WEB-INF/jsp/vets/vetsList.jsp b/src/main/webapp/WEB-INF/jsp/vets/vetList.jsp
similarity index 90%
rename from src/main/webapp/WEB-INF/jsp/vets/vetsList.jsp
rename to src/main/webapp/WEB-INF/jsp/vets/vetList.jsp
index 057454a..fc68b56 100644
--- a/src/main/webapp/WEB-INF/jsp/vets/vetsList.jsp
+++ b/src/main/webapp/WEB-INF/jsp/vets/vetList.jsp
@@ -24,10 +24,10 @@
 			  <tbody>
 				  <c:forEach var="vet" items="${vets.vetList}">
 				    <tr>
-				      <td>${vet.firstName} ${vet.lastName}</td>
+				      <td><c:out value="${vet.firstName} ${vet.lastName}" /></td>
 				      <td>
 					    <c:forEach var="specialty" items="${vet.specialties}">
-				          ${specialty.name}
+				          <c:out value="${specialty.name}" />
 				        </c:forEach>
 				        <c:if test="${vet.nrOfSpecialties == 0}">none</c:if>
 				      </td>
diff --git a/src/main/webapp/WEB-INF/mvc-view-config.xml b/src/main/webapp/WEB-INF/mvc-view-config.xml
index a917998..94ca95f 100644
--- a/src/main/webapp/WEB-INF/mvc-view-config.xml
+++ b/src/main/webapp/WEB-INF/mvc-view-config.xml
@@ -56,7 +56,7 @@
 	<!-- 	- The AtomView rendering a Atom feed of the visits  -->	 
 	<bean id="visitList" class="org.springframework.samples.petclinic.web.VisitsAtomView"/>
 
-	<bean id="vets/vetsList" class="org.springframework.web.servlet.view.xml.MarshallingView">
+	<bean id="vets/vetList" class="org.springframework.web.servlet.view.xml.MarshallingView">
 		<property name="marshaller" ref="marshaller"/>
 	</bean>
 
-- 
GitLab