Tutorials > Program model > Use Struts tags, action forms, and validation
Add the consumer direct store error message properties files as a Struts
This section refers to adding the error message properties files as a Struts.
For the Validator framework to be able to retrieve error messages from the consumer direct store error message properties files, configure the latter as a Struts message resource:
Procedure
- The struts-config-ext.xml file should still be open for editing in the Struts Configuration File editor.
- Switch to the Message Resources page of the editor.
- In the Message Resources section, click Add and type
ConsumerDirect/storeErrorMessages
- In the Message Resource attributes section, do the following:
- Click the Browse button next to the Factory field and select factory class...
com.ibm.commerce.struts.messages.WCPropertyMessageResourcesFactory
- In the Key field, type...
ConsumerDirect_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's struts-config.xml file...
- Navigate to...
Stores | Struts | <default module>
- Right-click struts-config.xml and select...
Open With | Struts Configuration File Editor | Message Resources | 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.
- Click the Browse button next to the Class Name field and select the class...
com.ibm.commerce.struts.messages.WCMessageResourcesConfig
- Switch to the Source view and verify that you see the following element near the bottom of the view:
<message-resources parameter="ConsumerDirect/storeErrorMessages" className="com.ibm.commerce.struts.messages.WCMessageResourcesConfig" factory="com.ibm.commerce.struts.messages.WCPropertyMessageResourcesFactory" key="ConsumerDirect_errors" null="true"> <set-property property="additionalProperties" value="com.ibm.commerce.ras.properties.ecServerMessages, ... "/> </message-resources>
- Save the changes.