Spring Framework - Display Warning Message as opposed to Error
I have Use Cases that require the User to be show a Warning message as opposed to an Error message. The user will be shown once and then they can proceed. My problem is since it's not a Validation error the flow goes thru and the operation is performed without displaying the message. Therefore the user performs开发者_开发知识库 an action, he is warned once and then let thru.
Am I missing something? I looked around but there doesn't seem to be the concept of a warning message in Spring. Thanks for your help or suggestion.
In my ignorance of Spring and Spring-MVC, I created a Messages
class that contains lists of errors and messages. I store an object of this type in the request scope and reference it in my JSP somewhat like this:
<c:if test="${Messages.hasMessages}">
<c:forEach items="${Messages.messages}" var="message">
${message}<br/>
</c:forEach>
</c:if>
<c:if test="${Messages.hasErrors}">
<c:forEach items="${Messages.errors}" var="error">
${error}<br/>
</c:forEach>
</c:if>
In my actual JSP, I style it as needed and generally dump messages and errors in a <ul>
list.
精彩评论