# How Do I: Customize Message Formats in Page Flows?

To display parameterized text in a JSP, you use the NetUI data binding tags netui-data:message and netui-data:messageArg. The netui-data:message tag binds to the string containing the argument references ({0}, {1}, and so forth), while the netui-data:messageArg tags provide the argument values. This is illustrated in the following example:

<%
pageContext.setAttribute("msgSkeleton", new String("To read about {0}, go to {1}."));
%>
...
<netui-data:message value="{pageContext.msgSkeleton}" resultId="message">
<netui-data:messageArg value="messaging"/>
<netui-data:messageArg value="my web page"/>
</netui-data:message>
...
<netui:label value="{pageContext.message}"/>

In the example the netui-data:message tag uses the value attribute to bind to the string, which was earlier added to the pageContext data binding object, replaces the argument references with the values provided in the two netui-data:messageArg tags, and makes the resulting string known as message in the pageContext via its resultID attribute.

You can also use the request data binding object to hold the string containing the argument placeholders. To do so, you can add this string to the request object in the calling action method, as is shown in the following example:

/**
* @jpf:action
* @jpf:forward name="success" path="message.jsp"
*/
protected Forward goToMessage()
{
getRequest().setAttribute("msgSkeleton", new String("To read about {0}, go to {1}."));
return new Forward("success");
}

And in the JSP, you would reference the request object as is shown below:

<netui-data:message value="{request.msgSkeleton}" resultId="message">
<netui-data:messageArg value="WebLogic Workshop"/>
<netui-data:messageArg value="www.bea.com"/>
</netui-data:message>
...
<netui:label value="{pageContext.message}"/>

Related Topics

Using Data Binding in Page Flows

Presenting Complex Data Sets in JSPs