Develop > Presentation layer > Work with JSP pages > Storefront customization tools > Web application


Define WebSphere Commerce error message resources: message-resources


Overview

Retrieving error messages, accomplished in earlier versions of WebSphere Commerce using the StoreErrorDataBean, can also be accomplished in the WebSphere Commerce Struts-based Web application with the Struts declarative exception handling framework. This framework relies on property message resources (resource bundles) defined in properties files and configured in the Struts configuration files using message-resources elements.


For sites with only one store or where all stores share the same error messages.

Configure the message resources as follows...

<message-resources factory="com.ibm.commerce.struts.messages.WCPropertyMessageResourcesFactory"
                   key="org.apache.struts.action.MESSAGE"              
                   null="false"
                   parameter="com.mycompany.properties.MySite" />       

    className="com.ibm.commerce.struts.messages.WCMessageResourcesConfig">     

    <set-property property="additionalProperties"
                  value="WebSphere Commerce properties files" />

</message-resources>

...where...

com.mycompany.properties.MySite.properties The site-wide properties file, which will be searched first. Place into...

WEB-INF/classes

...of the Stores Web module.

Commerce properties files A comma-separated list of the names of component properties files, without the .properties extension, such as...

    com.ibm.commerce.ras.properties.ecServerMessages, com.ibm.commerce.catalog.ras.properties.WcCatalogUserMessages, com.ibm.commerce.pa.ras.properties.WcPAUserMessages

Copy this list in its entirety from the Web module's struts-config.xml file.

Note also the WebSphere Commerce-specific values of the factory and className attributes.


For sites with multiple stores that do not share the same error messages but want to use messages supplied by WebSphere Commerce

Configure your message resources as follows...

<message-resources factory="com.ibm.commerce.struts.messages.WCPropertyMessageResourcesFactory"
                   key="org.apache.struts.action.MESSAGE"              
                   null="false"
                   parameter="" 
                   className="com.ibm.commerce.struts.messages.WCMessageResourcesConfig">     

    <set-property property="additionalProperties"
                  value="WebSphere Commerce properties files" />

</message-resources>

<message-resources factory="com.ibm.commerce.struts.messages.WCPropertyMessageResourcesFactory"
                   key="myStore"               
                   null="false"
                   parameter="com.mycompany.properties.MyStore"
                   className="com.ibm.commerce.struts.messages.WCMessageResourcesConfig">     

    <set-property property="additionalProperties"
                  value="WebSphere Commerce properties files" />

</message-resources>

...where...


+

Search Tips   |   Advanced Search