Samples > JSP code snippets > e-Marketing Spot (Management Center)


Sample e-Marketing Spot JSP snippets and the Web activities they support

Many WebSphere Commerce starter store pages contain e-Marketing Spots that display marketing information using Web activities. If you are adding e-Marketing Spots to a store page, you can review one of the starter store e-Marketing Spot snippets that provides the functions and parameters you need. You can then use the snippet as a starting point for the store.

A store page JSP file can include one or more e-Marketing Spot snippets. Each included snippet represents an e-Marketing Spot. The snippet selected for the e-Marketing Spot depends on several factors: the location of the e-Marketing Spot on the page, the type of Web activity that will run in the e-Marketing Spot, and whether the e-Marketing Spot requires added features, such as scrolling or pagination. A single snippet is often reused on more than one store page, or multiple times on the same store page.

The following e-Marketing Spot JSP snippets are used in the WebSphere Commerce starter stores to call the marketing services and return data to an e-Marketing Spot:

  1. ContentAreaESpot.jsp – A basic snippet formatted for the main content area.

  2. ESpotNavDisplay.jsp – A basic snippet formatted for the sidebar.

    The ESpotNavDisplay.jsp snippet also supports a specialized JSP fragment ESpotNavDisplayBrazilExt.jspf. This fragment adds additional promotion-related functions to an e-Marketing Spot to support Web activities that use the Display Promotional Price action or the Promotion Checker target.

  3. ScrollingProductsESpot.jsp – A snippet that displays a scrolling list of catalog entries.

  4. BrowseHistoryESpotDisplay.jsp – A snippet that displays a paginated list of catalog entries.

These snippets are installed at the following path when you publish a starter store archive, if the snippet is used in the starter store:

In addition to the snippets listed previously, WebSphere Commerce provides a generic WebServiceeMarketingSpotDisplay.jsp snippet. This snippet is a simplified e-Marketing Spot snippet that can be used as a starting point for any basic e-Marketing Spot (in fact, all the snippets previously listed evolved from this snippet). This snippet illustrates how to use the <getData> tag to get data from the Get MarketingSpotData Web service, and it provides an example of the data returned. This snippet does not do any formatting, pagination, or scrolling. This snippet is located here:

To learn more about any snippet, open the snippet in the development environment where you have the starter store published. Then read the comments in the code that provide examples of how to include the snippet on a store page and what the mandatory and optional parameters are. You can also open a starter store JSP page that includes the snippet and look at the code that specifies the parameters used for the snippet on that page.

The following section provides an overview of each snippet, and identifies a starter store page that uses the snippet.


ContentAreaESpot.jsp

This JSP snippet displays a basic e-Marketing Spot, formatted to fit in the main content area of a store page. The code in this JSP snippet can retrieve the following types of data from the Get MarketingSpotData service:

This snippet can display more than one data type at the same time. For example, you might have three Web activities running in the e-Marketing Spot: the first displays catalog entries, the second displays categories, and the third displays content. If so, this snippet is capable of displaying the catalog entries, categories, and content at the same time.

Example of a starter store page that includes this JSP snippet Web activity actions that this snippet can support
Madisons–Department page: The ContentAreaESpot.jsp snippet is included several times on this page to display different data types.


ESpotNavDisplay.jsp

This snippet displays a basic e-Marketing Spot, formatted to fit in the sidebar of a store page. The code in this JSP snippet can retrieve the following types of data from the Get MarketingSpotData service:

This snippet can display more than one data type at the same time. For example, you might have three Web activities running in the e-Marketing Spot: the first displays catalog entries, the second displays categories, and the third displays content. If so, this snippet is capable of displaying the catalog entries, categories, and content at the same time.

Example of a starter store page that includes this JSP snippet Web activity actions that this snippet can support
Madisons–Catalog: Overall layout: The ESpotNavDisplay.jsp snippet is used for several e-Marketing Spots that display in the sidebar of the store.


ScrollingProductsESpot.jsp

This snippet is used to display list of scrollable catalog entries or categories, within a scrollable pane widget in an e-Marketing Spot on a store page. This snippet creates a Dojo ContentPane widget for each catalog entry or category that the Get MarketingSpotData service returns. Then the scrollable pane widget produces the scrolling effect. For information about the scrollable pane widget, see wc.widget.ScrollablePane.

The code in this JSP snippet can retrieve the following types of data from the Get MarketingSpotData service:

Example of a starter store page that includes this JSP snippet Web activity actions that this snippet can support
Madisons–Home

See the e-Marketing Spot named HomePageFeaturedProducts, which displays a scrolling list of catalog entries for a clearance sale.


BrowseHistoryESpotDisplay.jsp

This snippet displays a paginated list of catalog entries in an e-Marketing Spot on a store page. The code in this JSP snippet can retrieve the following types of data from the Get MarketingSpotData service:

The snippet is formatted to display in the My Account area of the store, across the full width of a store page (excluding the navigation area in the left sidebar).

The snippet supports controls that customers can use to display the catalog entries as:

Example of a starter store page that includes this JSP snippet Web activity actions that this snippet can support
Madisons–My Account: Browsing History


ESpotNavDisplayBrazilExt.jspf

This is a specialized JSPF snippet that extends ESpotNavDisplay.jsp to add additional promotion-related functions to an e-Marketing Spot demonstrated on the Madisons Brazil starter store.

This snippet is used to display the following two types of Web activities:

  1. Web activities that use the Display Promotional Price action to calculate and display the discounted price of the catalog entry that the customer is currently viewing, as well as the short description of the promotion specified in the Web activity.

  2. Web activities that use the Promotion Checker target to determine whether a catalog entry that a customer is currently viewing qualifies for the promotion specified in the Web activity.

This JSPF snippet supports a number of specialized functions to display promotion-related data in an e-Marketing Spot. For example, this snippet supports a parameter, currentProductId, to pass the product ID of the product that the customer is currently viewing into the e-Marketing Spot. This parameter is required to determine whether the product qualifies for the promotion specified in the Web activity.

To learn more about the additional promotion-related functions this snippet supports, see the comments included in the snippet.


Important: This JSPF snippet is included only in the Madisons Brazil starter store. To access the snippet, you can either publish the Madisons Brazil starter store, or get the snippet directly out of the Brazil.sar store archive file, which installs at this path:

WCDE_INSTALL/starterstores/brazil-solution/Brazil.sar

Within the Brazil.sar store archive, the snippet is here:

/StoreAssetsDir/Snippets/Marketing/ESpot/ESpotNavDisplayBrazilExt.jspf

Example of a starter store page that includes this JSPF snippet Web activity actions that this snippet can support
Madisons Brazil–Home: There are several e-Marketing Spots on this page that use this JSPF snippet:

  • BrazilFeaturedNonPaymentPromotion

    (displays a Web activity that uses the Display Promotional Price action to display a category promotion discount)

  • BrazilFeaturedPaymentPromotion

    (displays a Web activity that uses the Display Promotional Price action to display a payment promotion discount)

  • BrazilFeaturedShippingPromotion

    (displays a Web activity that uses the Promotion Checker target with the Display Content action)

Action: Display Promotional Price

Also:

Action: Recommend Content when used with the Target: Promotion Checker target


+

Search Tips   |   Advanced Search