title: Proper way to set model errors in Spring Portlet MVC
body: <p>In my MVC controller I have a handler method with a signature:</p>
  
  <pre><code>public void myAction(ActionRequest request, ActionResponse response, Model model) {...}
  </code></pre>
  
  <p>And in this method I check if some submitted data is okay. If it's not valid, I want to set an error. Currently I do it this simple way:</p>
  
  <pre><code>model.addAttribute("operationStatus", "error");
  model.addAttribute("operationMessage", "a lot of things went wrong");
  </code></pre>
  
  <p>and in the view JSP:</p>
  
  <pre><code>&lt;c:if test="${requestScope.operationStatus == 'error'}"&gt;
      &lt;div class="msg-error"&gt;${requestScope.operationMessage}&lt;/div&gt;
  &lt;/c:if&gt;
  </code></pre>
  
  <p>Surely there has to be a better way to handle errors in Spring Portlet MVC. Note that I need to display the error messages in different places, not only in <code>&lt;form&gt;</code> tag.</p>
  
  <p>So how should I handle errors?</p>