Develop > Presentation layer > Work with Web service feeds
Changing the content and configuration of an Atom feed for remote widgets
If the default feed formatting JSP files for e-Marketing Spots, wish lists, and gift registries do not meet the business needs, you can create a custom set. By customizing these files, you have more control over the feed data available for display in remote widgets and feed readers. For example, you can change the number of feed entries to include in the feed, or add additional pieces of store data to the feed, if the data is available from the Web service. When you have completed the customization, register the top-level feed formatting JSP file in a Struts configuration file.
Before you begin
Review the following topics to understand the purpose and function of feed formatting JSP files and the Struts configuration file:
- Feed formatting JSP files for Atom feeds
- Example of an e-Marketing Spot Atom feed rendered in a feed reader and a remote widget
- Example of a wish list Atom feed rendered in a remote widget
- Example of a gift registry Atom feed rendered in a remote widget
- Struts configuration for specifying Atom feed formatting JSP files
Procedure
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- Create a new directory in which to store the custom set of JSP files at the following path:
WCDE_INSTALL/Rest/WebContent/atom/ For example:
WCDE_INSTALL/Rest/WebContent/atom/MyCustomFeedJSPs/
- Copy the full set of default feed formatting JSP files that to change to the new directory. The available sets are:
Set Location of default files Names of files in the set E-Marketing Spot feed formatting JSP file set WCDE_INSTALL/workspace/Rest/WebContent/atom/site-default/
SerializeShowMarketingSpotDataDataAreaTypeAtom.jsp
SerializeMarketingSpotDataAtom.jspf
SerializeMarketingSpotDataCatalogEntryAtom.jspf
SerializeMarketingSpotDataCatalogGroupAtom.jspf
SerializeMarketingSpotDataContentAtom.jspfPlus:
FeedEnvironment.jspf
Wish list and gift registry feed formatting JSP file set WCDE_INSTALL/workspace/Rest/WebContent/atom/site-default/
SerializeShowGiftListDataAreaTypeAtom.jsp
SerializeGiftListDataAtom.jspf
SerializeGiftListDataCatalogEntryAtom.jspfPlus:
FeedEnvironment.jspf
- Change any of the JSP files in the set.
For a description of each file's purpose, see Feed formatting JSP files for Atom feeds. Each JSP file also includes comments throughout to help you customize the file.
- Save the changes.
- Open the Struts configuration file for the RESTful framework at the following path:
WCDE_INSTALL/workspace/Rest/WebContent/WEB-INF/struts-extension.xml
- Add a new action mapping to register the top-level feed formatting JSP file in the new directory. For example, to register a customized set of feed formatting JSP files for e-Marketing Spots located in the MyCustomFeedJSPs directory, the new action mapping might look like the following line shown in bold text:
<struts-config> <action-mappings type="com.ibm.commerce.foundation.rest.struts.ECRestActionMapping"> <action path="/ShowMarketingSpotDataDataAreaTypeAtom/0" forward="/atom/MyCustomFeedJSPs/SerializeShowMarketingSpotDataDataAreaTypeAtom.jsp" /> </action-mappings> </struts-config>
- Save and close the Struts configuration file.
- Restart the WebSphere Commerce test server to make the new configuration available.
- Test the customized feed formatting JSP files by viewing the feed in various feed readers or in the widget editor you are using, such as KickApps App Studio. KickApps App Studio requires a machine that is accessible from the Internet to display feed data in a widget.
- Deploy your customized code.