Because a product can be accessed on multiple sites, it is often important for a page to obtain the correct site ID before enabling user access to product information. For example, you might define cross-sell and upsell lists that include items that belong to multiple sites. When a user selects an item, the application must be able to determine the best site ID to return for the selected item.

Given a product item, the servlet bean SiteIdForItem returns a site ID from a list of site IDs that are stored in the item’s siteIds property. The servlet bean chooses a site ID according to various input parameters and site priority settings, as described below. This site ID can be used to obtain useful information about the site itself. It can also be used to change site context and generate links to the site.