The following example is a page fragment that renders form success and failure messages. First, we make the I18nMessageProcessor components available:
<dsp:importbean bean="/atg/portal/admin/SuccessMessageProcessor"/> <dsp:importbean bean="/atg/portal/admin/FailureMessageProcessor"/> <dsp:getvalueof id="failureMessageProcessor" idtype="atg.portal.admin.I18nMessageProcessor" bean="FailureMessageProcessor"> <dsp:getvalueof id="successMessageProcessor" idtype="atg.portal.admin.I18nMessageProcessor" bean="SuccessMessageProcessor">\
Next, we invoke the localizeMessages method in the I18nMessageProcessor components.
<% failureMessageProcessor.localizeMessages(request, response); successMessageProcessor.localizeMessages(request, response); %>
The next step is to get the success messages and output them, using the core:ForEach tag.
<%-- Previous submission success/failure reporting --%>
<dsp:getvalueof id="successMessages" idtype="java.util.List"
bean="SuccessMessageProcessor.messages">
<core:ForEach id="successIterator"
values="<%=successMessages%>"
castClass="String"
elementId="successMessage">
<img src='<%= dmpage.getRelativeUrl("/html/images/info.gif")%>'>
<font class="info"><%=successMessage%></font><br>
</core:ForEach>
</dsp:getvalueof>We get the failure messages and output them in the same way.
<%-- failureMessages --%>
<dsp:getvalueof id="failureMessages" idtype="java.util.List"
bean="FailureMessageProcessor.messages">
<core:ForEach id="failureIterator"
values="<%=failureMessages%>"
castClass="String"
elementId="failureMessage">
<img src='<%=dmpage.getRelativeUrl("/html/images/error.gif")%>' >
<font class="error"><%=failureMessage%></font><br>
</core:ForEach>
</dsp:getvalueof><%-- failureMessages --%>Finally, we clear all the messages from the two I18nMessageProcessor components.
<% failureMessageProcessor.clear(); successMessageProcessor.clear(); %> </dsp:getvalueof><%-- successMessages --%> </dsp:getvalueof><%-- failureMessages --%>

