Feature Pack 4 or later

Using device detection for redirection to mobile-specific pages

Feature Pack 4 or later In this lesson, you will update the Struts configuration file to render the device-specific JSP file template when a request is made from a device with the corresponding ID defined in the wc-devices.xml file.

Procedure

  1. After completing the Mapping device-specific requests to a JSP file template prerequisite, take note of the internal ID value for your target mobile device in the wc-devices.xml file.
  2. Create and register a new JSP file for targeting mobile devices.
  3. Update the value of the name parameter of the <forward> entry corresponding to the mobile JSP file. Append the internal ID for your target mobile device, as defined in wc-devices.xml, preceded by a forward slash (/).

    For example, if a new search landing page JSP file has been created for a tablet device, where the internal ID for the tablet device is -31, append /-31 to the value for name.

    The resulting <forward> entry should resemble the following code snippet:
    
    <forward className="com.ibm.commerce.struts.ECActionForward"
    name="SearchLandingPage1/10101/-31"
    path="/tablet/ShoppingArea/CatalogSection/LandingPages/Sample1/LandingPage.jsp"/>