Accessing message data from the customized form

You can access the request attributes in the message data either programmatically or by using an expression language.

Why and when to perform this task

The expression language uses expressions similar to XML Path Language (XPath) expressions to access the parts of the message data. If you use an expression language, you must add the corresponding tag libraries to the user-defined JavaServer Pages (JSP) document.

The following attributes are stored in the request context:

Steps for this task

  1. Access message data.

    You can access the input and output data from the user-defined JSPs either programmatically with request attributes or by using an expression language.

    • Access the data using request attributes.
      You can obtain the message as a comonj.sdo.DataObject object or as the complete message map. The following example shows how to obtain the message as a data object.
      commonj.sdo.DataObject msg = 
        (commonj.sdo.DataObject)request.getAttribute("message")
      The following example shows how to access the complete message.
      java.util.Map msgMap = 
        (jave.util.Map)request.getAttribute("messageMap")
    • Access the data using an expression language statement.
      ...
      ${messageMap['/selectPromotionalGiftRequest/name']}
      ....
  2. Optional: Access input data from the output JSP page.

    If the output JSP page requires access to the input message, you have to transport the data explicitly from the input JSP document to the output JSP document.

    You can use JSTL statements and the message map to pass the input message to the output JSP document as shown in the following example.

    1. Add the tag library to the JSP document.
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    2. In the input JSP document, store the message map in the request.
      <c:set var="inputData" value="${messageMap}" scope="request" />
    3. In the output JSP document, access the request to get the complete message map.
      Map inputData = (Map)request.getAttribute("inputData"); 

Terms of use |

Last updated: Tue Feb 21 17:31:28 2006

(c) Copyright IBM Corporation 2005.
This information center is powered by Eclipse technology (http://www.eclipse.org)