After you create your slot component, you can use Scenarios to determine under what circumstances a gear will be displayed in a slot. The Creating Scenarios chapter in the Personalization Guide for Business Users provides information about how to create a scenario.

For example, you could create a scenario that adds a poll to a portal user’s home page upon login, and removes the poll after the user has voted in the poll. To do this, create a new scenario with the Logs in event followed by the Add items to slot action segment, and the Poll vote event followed by the Remove items from slot action segment:

This diagram is described in preceding text

The following JSP example shows how you might use a slot to render a gear. It assumes you’ve created a slot named /com/acme/slots/MyGearSlot. The TargetingFirst servlet bean is used to display the appropriate gear.

<%@ page import="atg.portal.servlet.*,atg.portal.framework.*" %>
<%@ taglib uri="/paf-taglib" prefix="paf" %>
<%@ taglib uri="/dsp" prefix="dsp" %>

<dsp:page>

  <dsp:droplet name="/atg/targeting/TargetingFirst">
  <dsp:param name="targeter" bean="/com/acme/slots/MyGearSlot"/>
  <dsp:oparam name="output">


      <dsp:getvalueof id="gearId" param="element.repositoryId"
                      idtype="java.lang.String">

<%
 //Obtain request/response
 PortalServletResponse portalServletResponse =
     (PortalServletResponse)request.getAttribute(Attribute.PORTALSERVLETRESPONSE);
 PortalServletRequest portalServletRequest =
     (PortalServletRequest)request.getAttribute(Attribute.PORTALSERVLETREQUEST);

 Portal portal = portalServletRequest.getPortal();
 if(portal != null) {
   Gear gear = portal.getGearById(gearId);

   if(gear != null) {
     //Create Gear Context
     GearContextImpl gearContext =
         new GearContextImpl((GearContext)portalServletRequest);
     gearContext.setGear(gear);
     gearContext.setGearMode(GearMode.CONTENT);

     //Dispatch Gear
     RequestDispatcher dispatcher =
         portalServletRequest.getRequestDispatcher(gearContext);
     if(dispatcher != null)
      dispatcher.include(request,response);
   }
 }
%>

      </dsp:getvalueof>

  </dsp:oparam>
</dsp:droplet>

</dsp:page>

Copyright © 1997, 2015 Oracle and/or its affiliates. All rights reserved. Legal Notices