Struts2 - 发送具体信息反馈消息

Struts2 - send specific information feedback message

如何测试上下文中是否存在特定操作消息?

<logic:messagesPresent message="error" property="my_error">
    <table>
        <tr>
          <td>
            <html:messages id="error" property="my_error">
                <bean:write name="error"/><br>
            </html:messages>
           </td>
         </tr>
     </table>
   </logic:messagesPresent>

我试过了,但我只需要搜索 my_error 条消息。

<s:if test="hasActionMessages()">
                <table>
                    <tr>
                        <td >
                            <s:actionmessage/>
                        </td>
                    </tr>
                </table>
</s:if>

操作消息不是错误,它们保存在一个单独的集合中。无论操作的验证状态如何,它都可以提供。

操作消息更适合用户反馈,因为它不会影响流程。另一方面,操作错误会使操作无效。

<s:if test="hasActionMessages()">
    <table>
        <tr>
            <td >
                <s:actionmessage/>
            </td>
        </tr>
    </table>
</s:if>