JSP code snippet for e-Marketing Spots (WebSphere Commerce Accelerator)

This eMarketingSpotDisplay.jsp is built as a sample snippet to display an e-Marketing Spot in a store page. This e-Marketing Spot code supports all types of Web activities.

  • Products, items and category suggestions
  • Content
    • Awareness Advertisements
  • Discount Advertisements
  • Coupons Advertisements
  • Merchandising Association
    • Cross-sell and Up-Sell
If you intend to display only one type of the campaign Web activity in your e-Marketing Spot, sections of the code that will not be used can be removed.

Prerequisites:

These two parameters are required by this code:

emsName
This file can be reused in different pages of the store by including it and giving a unique value for emsName, which should match exactly with an eMarketingSpot name that is defined in the WebSphere Commerce Accelerator.
catalogId
catalogId needs to be passed in as it is required to build the proper URL.

How to use this snippet

This is an example of how this file could be included into a page:


 <c:import
url="${jspStoreDir}include/eMarketingSpotDisplay.jsp">
 <c:param name="emsName" value="ShoppingCartPage" />
 <c:param name="catalogId" value="${WCParam.catalogId}" />
 </c:import>
If special characters are used in the e-Marketing Spot name, and they need to be encoded in order to pass them successfully to this page through request parameter, the use the following technique to set the emsName parameter in the import statement:

request.setAttribute("emsName",
java.net.URLEncoder.encode("ShoppingCartPage"));
And retrieve it from the request when setting the parameter:

<c:param name="emsName" value="${requestScope.emsName}"/>
Note: eMarketingSpotDisplay.jsp contains absolute paths because it is referenced inside another JSP file, that is used as an e-mail template. In order for the e-mail content to be displayed properly, an absolute path to the images is required. If you are using this JSP file as part of your store front and not in your e-mail templates, you can change it to use relative paths. Note that if you do not make the change to the relative path, the browser might display the following SSL warning: your page is showing both secure and non-secure items do you want to display them?.