Tutorials > Program model > Use Struts tags, action forms, and validation

< Previous | Next >


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

  1. The struts-config-ext.xml file should still be open for editing in the Struts Configuration File editor.

  2. Switch to the Message Resources page of the editor.

  3. In the Message Resources section, click Add and type

    ConsumerDirect/storeErrorMessages

  4. In the Message Resource attributes section, do the following:

    1. Click the Browse button next to the Factory field and select factory class...

      com.ibm.commerce.struts.messages.WCPropertyMessageResourcesFactory

    2. In the Key field, type...

      ConsumerDirect_errors

    3. Select the Null check box.

  5. In the Message Resource Mapping Extensions section:

    1. Click Add.

    2. In the Property field, type...

      additionalProperties

    3. In the Value field, paste the value of the additionalProperties property from the Store module's struts-config.xml file...

      1. Navigate to...

        Stores | Struts | <default module>

      2. Right-click struts-config.xml and select...

        Open With | Struts Configuration File Editor | Message Resources | com.ibm.strutsstore.resources.ApplicationResources

      3. In the Message Resource Mapping Extensions section, select the entry for the additionalProperties property.

      4. Click the corresponding entry in the Value column, right-click it, and select Copy.

      5. Switch back to the editor of the struts-config-ext.xml file.

      6. Click the highlighted entry in the Value column, right-click it, and select Paste.

    4. Click the Browse button next to the Class Name field and select the class...

      com.ibm.commerce.struts.messages.WCMessageResourcesConfig

  6. 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>
    

  7. Save the changes.

< Previous | Next >


+

Search Tips   |   Advanced Search