<tr>
<td>${labelContactBirthDate}</td>
<td><joda:format value="${contact.birthDate}"
pattern="${dateFormatPattern}"/></td>
</tr>
<tr>
<td>${labelContactDescription}</td>
<td>${contact.description}</td>
</tr>
</table>
<a href="${editContactUrl}/${contact.id}?form">${labelContactUpdate}</a>
</div>
</div>
The page is simple; it simply displays the model attribute contact within the page.
The final step is to modify the view definition file (/views/contacts/views.xml) for mapping the
logical view name contacts/show. Simply append the code snippet in Listing 17-29 into the file, under
the <tiles-definitions> tag.
Listing 17-29. The Show Contact View Mapping
<definition extends="default" name="contacts/show">
<put-attribute name="body"
value="/WEB-INF/views/contacts/show.jspx" />
</definition>
The show contact view is complete. Now we need to add an anchor link into the contact list view
(/views/contacts/list.jspx) for each contact to the show contact view. Listing 17-30 shows the
modification required.
Listing 17-30. Add the Anchor Link in the List Contact View
<spring:url value="/contacts/" var="showContactUrl"/>
<!-- Other code omitted -->
<td>
<a href="${showContactUrl}/${contact.id}">${contact.firstName}</a>
</td>
As shown in Listing 17-30, we declare an URL variable using the <spring:url> tag and add an anchor
link for the firstName attribute. To test the show contact view, upon rebuild and deploy, open the
contact list view again. The list should now include the hyperlink to the show contact view, as shown in
Figure 17-11.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home