Methods for retrieving configuration parameters from the STORECONF table

You can use the StoreConfigurationRegistry to access store configuration values in the STORECONF database table from either Java code or JSP files.

The StoreConfigurationRegistry is a cache for the STORECONF table. The STORECONF table contains configuration-related parameters (name-value pairs) for specific stores. For example, the table contains a number of default configuration values for WebSphere Commerce Search. The table can also store custom configuration values, such as the Facebook application ID for a store that is integrated with Facebook. You can load any custom values to the table by using SQL statements or the Data Load utility. For instructions on how to load data to this table, see Adding extension logic to all store pages.

The STORECONF data is not propagated from staging to production. Therefore, you can have configurations and test systems set up in your staging environment that are different from your production environment.

As an alternative to the StoreConfigurationRegistry, you can use the store REST resource with the IBM_Store_Conf profile to access data in the STORECONF table. For more information, see the store REST resource.

Java code example

From Java code, you can access the StoreConfigurationRegistry directly. The following example code retrieves the value for a parameter in the STORECONF table for a specified store:
StoreConfigurationRegistry storeConfigurationRegistry = StoreConfigurationRegistry.getSingleton();
String value = storeConfigurationRegistry.getValue(storeId, "STORECONF_Name");
public String getValue(Integer storeId, String name)

Where:

storeId
The store entity ID of the store for which you want to retrieve the configuration data, for example, 10001.
STORECONF_Name
The name of the store configuration value to retrieve, for example, wc.store.displayListPriceInProductPage. Get the name from the STORECONF.NAME column.

JSP file example

You can use the <wcst:storeconf> tag in a store JSP file to access configuration parameters from the STORECONF table. The <wcst:storeconf> tag reads from the StoreConfigurationRegistry cache to provide access to the configuration parameters. This tag is provided with the WebSphere Commerce Stores tag library (stores.tld). In the default JSTLEnvironmentSetup.jspf file for the Aurora starter store, the library is included, as shown here:

<%@ taglib uri="http://commerce.ibm.com/foundation-fep/stores" prefix="wcst" %>

The following example shows how to use the tag in a store page to get the parameter named wc.store.displayListPriceInProductPage from the STORECONF table:

<wcst:storeconf var="confDisplayListPriceInProductPage" name="wc.store.displayListPriceInProductPage" scope="request" /> 

The <wcst:storeconf> tag accepts three parameters:

var
The variable that stores the store configuration value from the STORECONF table.
name
The name of the store configuration value to retrieve, for example, wc.store.displayListPriceInProductPage. Get the name from the STORECONF.NAME column.
scope
The scope for the instance variables that are specified by the var parameter. Use any of the following scope values:
  • page
  • request
  • session
  • application

If the scope parameter is not set, then the default value is page.