Introduced in Feature Pack 1

Feed formatting JSP files for Atom feeds

The WebSphere Commerce RESTful framework uses JSP files to format the content of an Atom feed. These JSP files control the images and text to include in the Atom feed, and perform some additional feed configuration functions. When a feed reader or widget initiates a request to display a feed, the RESTful framework uses these feed formatting JSP files to convert the service data object (SDO) to an Atom feed.

Data provided to the feed formatting JSP files

The RESTful framework passes the following information to the feed formatting JSP files:

  • The SDO returned from the Web service
  • The business context parameters, for example, the storeId, catalogId, locale, and langId
  • Store configuration information, for example, the Web server host name

Function of feed formatting JSP files

A feed formatting JSP file must:
  1. Get the data from the SDO returned from the Web service. The following is an example of the JSP code that gets data from an SDO returned from the Get MarketingSpotData service:
    <c:set var="marketingSpotDatas" value="${dataObject.marketingSpotData[0]}"/>
  2. Specify the data to include in the feed and produce a valid output according to the Atom Syndication Format 1.0 specification. This specification is available on the Internet. It lists the mandatory and optional elements to use in an Atom feed and includes examples of valid Atom-format XML documents.

Feed formatting JSP files supplied with WebSphere Commerce

WebSphere Commerce includes several sets of feed formatting JSP files for supported WebSphere Commerce Web services. There is one set for e-Marketing Spot Atom feeds and another set for wish list Atom feeds. These feed formatting JSP files produce a default feed output, but you can create a custom set if your site requires a different output.

The top-level JSP file in each set is invoked. The additional JSPF files in the each set perform various functions when formatting the Atom feed. The following table summarizes the function of each file in the set; for additional details about each file, open the file and read the comments within the file. The default files are located here:

WebSphere Commerce DeveloperWCDE_installdir/Rest/WebContent/atom/site-default/

File in the set Purpose Name of file for each feed type
Top-level feed formatting JSP file

The primary purpose of this file to get data from the SDO returned from the service. For example, for e-Marketing Spot feeds, this file includes the following line of code:

<c:set var="marketingSpotDatas"  value="${dataObject.marketingSpotData[0]}"/>

This file also specifies certain configurable settings for the Atom feed, for example:

  • Specifies whether to open a new browser when a customer clicks a link.
  • Specifies the properties file to use for text strings in the feed, for example, the feed title.

This file is specified in the Struts configuration file because it is the top-level file.

Two JSP files from the set are included in this file:
  • The feed environment JSP file (FeedEnvironment.jspf)
  • The feed formatting JSP file for the Atom feed element.
For e-Marketing Spot feeds:

SerializeShowMarketingSpotDataDataAreaTypeAtom.jsp

For wish list feeds:

SerializeShowGiftListDataAreaTypeAtom.jsp

Feed environment JSP file This file sets common variables used for all feed types, that is, e-Marketing Spot feeds and wish list feeds. By default, all top-level feed formatting JSP files point to the same feed environment file.

Functions of this file include:

  • Setting variables for the data that the JAX-RS provider Java class passes, for example, the storeId, catalogId, locale, langId. This information is used for various purposes. For example, if the feed contains a link back to the storefront, the storeId value ensures the customer is returned to the correct store.
  • Setting the location of static and dynamic content to include in the feed, as well as the store directory.
  • Setting the default commands used for displaying products, categories, and click info.
  • Specifying the format for dates displayed in the feed, according to the Atom standard.
For all feeds:

FeedEnvironment.jspf

Feed formatting JSP file for the Atom feed element

This file defines the mandatory and optional content for the atom:feed element, based on the Atom Syndication Format requirements. This content is the text and data that the customer typically sees at the top of the feed, for example, the feed title and the store logo. For your convenience, a number of optional Atom elements are also included in this file if you choose to use them, such as the <subtitle> and <icon> elements. These elements are commented out in the default files.

For certain elements, the values are not specified directly in the JSP file; instead, the JSP file references a properties file that contains the actual text strings.

This file includes the feed formatting JSP file for feed entries.

For e-Marketing Spot feeds:

SerializeMarketingSpotDataAtom.jspf

For wish list feeds:

SerializeGiftListDataAtom.jspf

Feed formatting JSP files for the Atom feed entry element These files define the content for the atom:entry element, based on the Atom Syndication Format requirements. Each file gathers the specific data required to create a feed entry, based on the type of store data the feed displays.
For example, the SerializeMarketingSpotDataCatalogEntryAtom.jspf file gathers the following feed entry data about a catalog entry:
  • Catalog entry thumbnail image
  • Catalog entry name
  • Catalog entry short description
  • Catalog entry standard price
  • Catalog entry list price
Important: Each of these files contains feed elements that are Atom standard elements, that is, elements that are defined in the Atom Syndication Format specification. In addition, each file includes a set of Atom extension elements:
  • To display feed entry data in a feed reader:

    Feed readers typically render the HTML content within the Atom standard <content> element included in these files. For example, the data about a catalog entry (name, thumbnail, and price) is rendered from the HTML within the <content> element.

For e-Marketing Spot feeds:
  • SerializeMarketingSpotDataCatalogEntryAtom.jspf (for a feed that displays catalog entries)
  • SerializeMarketingSpotDataCatalogGroupAtom.jspf (for a feed that displays categories)
  • SerializeMarketingSpotDataContentAtom.jspf (for a feed that displays marketing content)

For wish list feeds:

SerializeGiftListDataCatalogEntryAtom.jspf