Java Reference
In-Depth Information
Figure 15.13: The contact form appears below the contact table.
Download email_36/web/WEB-INF/jsp/parts/contact_table.jsp
<s:link beanclass="stripesbook.action.ContactListActionBean"
event="delete"
onclick="return ajaxLink(this, '#contact_table');">
<s:param name="contact" value="${contact}"/>
<img src="${contextPath}/images/delete.gif" border="0"/>
</s:link>
Notice how we're reusing the ajaxLink ( ) function. In fact, the delete link
is quite similar to the contact details link. We're just using a differ-
ent event on the action bean, updating a different portion of the page
( '#contact_table' instead of '#contact_details' ), and showing a different
icon. In the action bean, the delete ( ) event handler deletes the contact
and returns a page fragment with the refreshed contact list table.
Ajaxifying the Contact Form
To complete the Ajaxification of the contact list, let's make the con-
tact form appear below the table, as in Figure 15.13 . The form is pre-
populated when the user updates an existing contact and is blank for
creating a new contact—same as before.
Making the contact form appear in the '#contact_form' placeholder
works the same way as the other Ajax links we've created so far:
Download email_36/web/WEB-INF/jsp/parts/contact_table.jsp
<s:link beanclass="stripesbook.action.ContactFormActionBean"
onclick="return ajaxLink(this, '#contact_form');">
 
 
Search WWH ::




Custom Search