Integrate User Generated Content with Audience Manager Contacts, or with your custom contacts stored in your custom user management system, from a JSP website.
Procedure
- Access the SDL Tridion Sites installation media.
- Navigate to the folder Content Delivery\resources\samples\ugc\java.
- Open changeProfile.jsp the file in a plain-text editor. This file is an updated version of the sample changeProfile.jsp page that SDL Tridion Sites ships with. User Generated Content code has been added to it.
- Open your own JSP webpage that your visitors use to log in and to change their profile, in a plain-text editor.
- Copy the list of
<%@ page...%> directives from the top of changeProfile.jsp to your JSP webpage, inserting it at the top.
- Find the static method called
syncUGCUserWithContact and copy it to your JSP webpage.
- In your webpage, find the places in your code where the user has successfully logged in, and where the user has changed his or her profile. In this location, make the call to the method you just added, catching any exceptions thrown:
// Sync User Generated Content User
try {
syncUGCUserWithContact(contact);
} catch (StorageException e) {
addToErrorMessage(errorBuffer, "Unable to set current Contact as current User Generated Content user. " + e.getMessage());
}
- Save and close your JSP webpage.