Showing Friendship Notifications
The user should get a notification when his friendship request is accepted or rejected and may be when he is removed from someone's friend list. Here is an example script on how to show the notification that someone has accepted the friendship request.
<community:friendsNotifications id="acceptingUsers" name="communityUser" type="Accepted" /> <c:forEach var="acceptor" items="${acceptingUsers}" > <div> ${acceptor.article.title} <html:form action="/notification/friendship/clear"> <html:hidden property="userId" value="${me.id}"/> <html:hidden property="friendId" value="${acceptor.id}"/> <html:submit value="Clear"/> </html:form> </div> </c:forEach>
Similar notifications can be shown for rejection or removal of friendship using different values for the
type
attribute. For further details on this tag
and other tags related to friendship, see
Escenic Community
Expansion Taglib Reference: Chapter 4: community.
Once the user has read the notification, he will want to remove it. This way, he does not have a
homepage stuffed with a lot of notifications. The script above showed how to clear the friendship notification
using the Struts action /notification/friendship/clear
.
The action class that serves this purpose is
com.ndc.community.struts.actions.friendship.ClearFriendshipNotification
.
The form used for the action is com.ndc.community.struts.actions.forms.FriendshipForm
Form Property | Description |
---|---|
|
The ID of the user who gets the notification. |
|
The ID of the user whose action (acceptance, rejection or removal) has created the notification. |