Updating the Web application configuration
You have two options for updating the WebSphere Commerce Struts configuration while the WebSphere Commerce application is running.The two options are:
- Using store publish
Use this option to propagate custom store configuration to your WebSphere Commerce Web application configuration at publish time while keeping the configuration information as part of the SAR.
- Updating the Struts configuration directly
Use this option to make pervasive, site-wide, store-independent changes to your WebSphere Commerce Web application configuration.
Procedure
- Updating the Struts configuration with store publish
- Navigate to the WEB-INF/stores/ yourStoreName/data/ subdirectory of your SAR package root directory.
- Create a struts-config-update.tpl.xml file.
- Follow the same schema and general structure as the Store module's primary Struts configuration file, struts-config.xml file. Refer to the struts-config-update.tpl.xml files provided as part of the WebSphere Commerce starter store SAR packages for examples.
- Instead of inserting the actual store ID for your store, use the ${storeId} substitution variable. For example:
<forward className="com.ibm.commerce.struts.ECActionForward" name="AddressBookForm/ ${storeId} " path="/UserArea/AccountSection/AddressbookSubsection/AddressBookForm.jsp"> </forward> <set-property property="authenticate" value=" ${storeId} :1" />
- Open the store publish control file, ibm-wc-load.xml, to make the following changes:
- Copy the following asset elements to the end of the asset definition section
<asset id="strutsConfigUpdate.template" location="struts-config-update.tpl.xml" /> <asset id="strutsConfigUpdate" location="struts-config-update.xml" /> <asset id="strutsTileConfigUpdate.template" location="tiles-defs-update.tpl.xml" /> <asset id="strutsTileConfigUpdate" location="tiles-defs-update.xml" />These define the names and locations of your Struts and Tiles input and output configuration update files.- Copy the following deploy-task-cmd elements to the end of the deployment task command definition section
<deploy-task-cmd name="commandInvoker" class="com.ibm.commerce.tools.devtools.publish.tasks.CommandInvokerTaskCmd" /> <deploy-task-cmd name="findStore" class="com.ibm.commerce.tools.devtools.publish.tasks.StoreIdBaseDeployTaskCmd" /> <deploy-task-cmd name="fileFilter" class="com.ibm.commerce.tools.devtools.publish.tasks.unpack.FileFilterTaskCmd" />These define the task commands that you will refer to in the next step.
- Copy the following task elements to the end of the target element with id="all"
<!-- This task determines the actual ID for your store, which has been generated earlier in the publish process. Note that STORE_IDENTIFIER, ORGENTITYNAME, and ORGANIZATION_DN are the entity names defined in the ForeignKeys.dtd file found in the current directory and might be different for your SAR. --> <task name="findStore"> <param name="storeIdentifier" value="${asset:foreignKeys#STORE_IDENTIFIER}" /> <param name="organizationDN" value="ou=${asset:foreignKeys#ORGENTITYNAME},${asset:foreignKeys#ORGANIZATION_DN}" /> <export name="storeEntityId" value="storeEntityId" /> </task> <!-- This task replaces all the ${storeId} occurrences in your struts-config-update.tpl.xml file with the actual store ID determined in the preceding substep and creates a struts-config-update.xml file to be used in the following substep. --> <task name="fileFilter"> <param name="input-filename" value="${asset:strutsConfigUpdate.template}" /> <param name="output-filename" value="${asset:strutsConfigUpdate}" /> <param name="storeId" value="${context:storeEntityId}" /> </task> <!-- This task effects the update to the Stores Web module Struts configuration file. It will make a backup copy of the current version of the Struts configuration file before replacing it with an updated version. --> <task name="commandInvoker"> <param name="invoked_commandClassName" value="com.ibm.commerce.struts.commands.UpdateStrutsConfigFileCmd" /> <param name="webAppName" value="Stores" /> <param name="updateFileName" value="${asset:strutsConfigUpdate}" /> </task> <!-- This task effects the refresh of the WebSphere Commerce registry. --> <task name="commandInvoker"> <param name="invoked_commandClassName" value="com.ibm.commerce.scheduler.commands.RefreshRegistryCmd" /> <param name="URL" value="/ignore" /> </task>- Save your changes.
- Publish your store archive.
- Updating Struts configuration directly.
- Edit the WebSphere Commerce Struts custom configuration files for the appropriate Web modules.
- Update the registry component named StrutsConfigRegistry.
Related concepts
WebSphere Commerce Struts framework
Store publish processRelated tasks
Configure a Web application
Customizing the Web application configuration
Publish your store