Java Reference
In-Depth Information
public void
setContact(Contact contact) {
User user = contact.getUser();
if
(user ==
null
|| getUser().equals(user)) {
this
.contact = contact;
}
}
}
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:
<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
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