Struts - Alternative of <html:errors /> to display error messages in Jsp?

java, jsp, struts

Solution

By setting the attribute `message="false"` on the `<html:messages />` tag, it gets all errors stored on `ActionMessages` list if `saveErrors` was called.

<logic:messagesPresent message="false">
                        <html:messages id="aMsg" message="false">
                            <logic:present name="aMsg">
                                <!-- Error -->
                                <div class="error">
                                    <bean:write name="aMsg" filter="false" />
                                </div>
                            </logic:present>
                        </html:messages>
                    </logic:messagesPresent>

The `<html:messages id="aMsg" message="false">` display messages stored on `saveErrors` while `<html:messages id="aMsg" message="true">` display messages stored on `saveMessages`. There is no more `ActionErrors` object, just `ActionMessages`. The 'saveErrors' and 'saveMessages' method seperates the errors and messages respectively.

Problem

Struts - Alternative of `<html:errors />` to display error messages in Jsp?

Original source

Related problems