Friday, 1 May 2020

ATG 11.1 Responsive information

How to get the static  content in responsive design means using Service?


TargetingForEach targetingForEach = (TargetingForEach) ServletUtil.getCurrentRequest().resolveName("/atg/targeting/TargetingForEach");
pRequest.setParameter("targeter", (DynamicContentTargeter) ServletUtil.getCurrentRequest().resolveName(targeterComponent));
if (targeterComponent.equalsIgnoreCase("Targetter compnent name referred from one of the atg Component")) {
pRequest.setParameter("fireViewItemEvent", false);
pRequest.setParameter("fireContentEvent", false);
pRequest.setParameter("fireContentTypeEvent", false);
}
targetingForEach.service(pRequest, pResponse);
return (String) pRequest.getParameter("element.contentData");

In the above code, the  targeterComponent is the required atg targeter component


Same functionality with small difference

TargetingForEach targetingForEach = (TargetingForEach) ServletUtil.getCurrentRequest().resolveName("/atg/targeting/TargetingForEach");
pRequest.setParameter("targeter", (DynamicContentTargeter) ServletUtil.getCurrentRequest().resolveName(targeterComponent));
pRequest.setParameter("elementName", pElementName);
if (targeterComponent.equalsIgnoreCase("Targetter compnent name referred from one of the atg Component")) {
pRequest.setParameter("fireViewItemEvent", false);
pRequest.setParameter("fireContentEvent", false);
pRequest.setParameter("fireContentTypeEvent", false);
}
targetingForEach.service(pRequest, pResponse);
return (String) pRequest.getLocalParameter(pElementName+".contentData");



No comments:

Post a Comment