如何使用SpringWebFlow在jsp中显示非验证错误

如何使用SpringWebFlow在jsp中显示非验证错误,spring,spring-webflow,Spring,Spring Webflow,如何使用SpringWebFlow在jsp中显示非验证错误 相当于struts ActionErrors的东西/ Thxspringwebflow在后台使用springmvc。但是,将消息手动添加到位于RequestContext内部的MessageContext对象中,我们可以在屏幕上显示错误消息。这与存储验证错误消息的位置相同。我的解决方案如下: <c:forEach items='<%=((RequestContext) jspContext.findAttribute("fl

如何使用SpringWebFlow在jsp中显示非验证错误

相当于struts ActionErrors的东西/


Thx

springwebflow在后台使用springmvc。但是,将消息手动添加到位于RequestContext内部的MessageContext对象中,我们可以在屏幕上显示错误消息。这与存储验证错误消息的位置相同。

我的解决方案如下:

<c:forEach items='<%=((RequestContext) jspContext.findAttribute("flowRequestContext")).getMessageContext().getMessagesBySource(null)%>' var="msg">
    <c:choose>
        <c:when test="${msg.severity.label eq 'Error'}">
            ERROR: ${msg.text}
        </c:when>
        <c:otherwise>
            ERROR: ${msg.text}
        </c:otherwise>
    </c:choose>
</c:forEach>
试试这个

<c:forEach items="${flowRequestContext.messageContext.allMessages}"     var="message">
  <li>
    Message Source is ${message.source}
    <br>
    Message Text is ${message.text}
  </li>
</c:forEach>

  • 消息源为${Message.Source}
    消息文本为${Message.Text}
  • 归功于此

    <c:forEach items="${flowRequestContext.messageContext.allMessages}"     var="message">
      <li>
        Message Source is ${message.source}
        <br>
        Message Text is ${message.text}
      </li>
    </c:forEach>