Adding the Madisons store error message properties files as a Struts
In this lesson, you learn to add the error
message properties files as a Strut.
About this task
For the Validator framework to be able to retrieve error messages from the Madisons store error message properties files, you must configure the latter as a Struts message resource:
Procedure
- Open the struts-config-ext.xml file for editing if it is not already opened.
- Switch to the Message Resources page of the editor.
- In the Message Resources section, click
Add. Type
Madisons/storeErrorMessages
. - In the Message Resource attributes section, add the following
information:
- In the Factory field, type com.ibm.commerce.struts.messages.WCPropertyMessageResourcesFactory.
- In the Key field, type Madisons_errors.
- Select the Null check box.
- In the Message Resource Mapping Extensions section:
- Click Add.
- In the Property field, type additionalProperties.
- In the Value field, paste the value of the additionalProperties
property from the Store module struts-config.xml file as follows:
- Navigate to Stores > WebContent > WEB-INF.
- Right-click the struts-config.xml file and select Open With > Struts Configuration File Editor.
- Click the Message Resources tab.
- In the Message Resources section, select com.ibm.strutsstore.resources.ApplicationResources.
- In the Message Resource Mapping Extensions section, select the entry for the additionalProperties property.
- Click the corresponding entry in the Value column, right-click it, and select Copy.
- Switch back to the editor of the struts-config-ext.xml file.
- Click the highlighted entry in the Value column, right-click it, and select Paste.
- In the Class Name field, type com.ibm.commerce.struts.messages.WCMessageResourcesConfig as the class.
- Switch to the Source view and verify that you see the
following element near the bottom of the view:
<message-resources parameter="Madisons/storeErrorMessages"> className="com.ibm.commerce.struts.messages.WCMessageResourcesConfig"> factory="com.ibm.commerce.struts.messages.WCPropertyMessageResourcesFactory"> key="Madisons_errors" null="true"> <set-property property="additionalProperties" value="com.ibm.commerce.ras.properties.ecServerMessages, ... "/> </message-resources>
- Ensure that the MyContactUsDisplay.jsp calls the correct
key element that you created in step 4b.
- Navigate to Stores > WebContent > Madisons > StoreInfoArea and open MyContactUsDisplay.jsp.
- Search for the code:
<html:errors bundle="
Ensure that the bundle variable is set to Madisons_errors like the following code:<html:errors bundle="Madisons_errors"/>
- Save your changes.