Java Reference
In-Depth Information
public void setContact(Contact contact) {
User user = contact.getUser();
if (user == null || getUser().equals(user)) {
this .contact = contact;
}
}
}
Download email_36/src/stripesbook/action/ContactListActionBean.java
public class ContactListActionBean extends ContactBaseActionBean {
private static final String DETAILS =
"/WEB-INF/jsp/parts/contact_details.jsp";
public Resolution details() {
return new ForwardResolution(DETAILS);
}
}
The contact_details.jsp file renders the contact information exactly like
before, but without the surrounding page layout. The JSP also includes
the “x” icon at the bottom:
Download email_36/web/WEB-INF/jsp/parts/contact_details.jsp
<table class="view">
<tr>
<td class="label"><s:label for="contact.firstName"/> : </td>
<td class="value">
${fn:escapeXml(actionBean.contact.firstName)}
</td>
</tr>
<!-- same for other fields... -->
</table>
<a href="#" style="padding-left: 24px;"
onclick="$('#contact_details').hide();">
<img src="${contextPath}/images/close.png" border="0"/>
</a>
The fragment is put back into the #contact_details placeholder, next to
the contact table, and we get the result from Figure 15.12 , on the pre-
ceding page. The user can click the “x” to remove the contact details
portion from the page.
Instant Delete
Since we're making the contact list more clickety-click-click, let's shun
that “Are you sure?” pop-up box and delete the contact when the user
clicks the “x” icon, instantly refreshing the contact table.
 
 
Search WWH ::




Custom Search