You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Caine Lai <ca...@gmail.com> on 2007/04/25 06:25:59 UTC

How do I access Struts 2 action errors in request from Freemarker view.

I'm trying to figure out a way to access the Struts 2 action messages in a
Freemarker template.  I copied the following code from the Struts template
directory, into my Freemarker view, but the action errors do not show up,
which tells me I must not be using the correct variable.

[#if (actionErrors?exists && actionErrors?size > 0)]
    <ul>
    [#list actionErrors as error]
        <li><span class="errorMessage">${error}</span></li>
    [/#list]
    </ul>
[/#if]


I've also tried Request.actionErrors, but this doesn't work either.

Does anyone have an idea how I can get access to these?  I need to be able
to customize the output of these messages.  I know there is a way to
override the Struts 2 default template, but I need to combine actionErrors
and actionMessages in a single template.

Thanks for any help.