Develop > Presentation layer > Work with Web service feeds


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:


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 and gift registry Atom feeds. These feed formatting JSP files produce a default feed output, but you can create a custom set if the 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:

WCDE_INSTALL/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.

  • Specifies the maximum number of feed entries to display in the feed.

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 and gift registry feeds:

SerializeShowGiftListDataAreaTypeAtom.jsp

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

Functions of this file include:

  • Set 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.

  • Set the location of static and dynamic content to include in the feed, as well as the store directory.

  • Set the default commands used for displaying products, categories, and click info.

  • Specify 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 the 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 and gift registry 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


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.

  • To display feed entry data in a remote widget:

    The WebSphere Commerce templates in KickApps use the Atom feed extension elements included in these files, rather than the <content> element. These extension elements provide more granular feed entry data for display in Flash widgets. This makes it easier to edit and rearrange the data in the widget.

    For example, the SerializeMarketingSpotDataCatalogEntryAtom.jspf file includes the following extension elements to display catalog entry data in a remote widget:

    • <name>: The name of the catalog entry

    • <description>: The short description of the catalog entry

    • <longDescription>: The long description of the catalog entry

    • <thumbnail>: The thumbnail image of the catalog entry

    • <listPrice>: The list price of the catalog entry

    • <price>: The standard price of the catalog entry

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 and gift registry feeds:

SerializeGiftListDataCatalogEntryAtom.jspf


Related concepts

Remote widgets


+

Search Tips   |   Advanced Search