title: Enable custom error message in JSP through Java
body: <p>I am currently working with JSP, Java servlets.</p>
  
  <p>I am adding custom error messages for a form, I am following the example found on this site <a href="http://materializecss.com/forms.html" rel="nofollow">http://materializecss.com/forms.html</a> under 'Custom Error or Success Messages'. What I want to do is once the user submits information it gets processed through a java servlet, if the Java servlet find an error with the users input, I want to enable the red error line that appears when an invalid input is entered. </p>
  
  <p>The code I currently have is </p>
  
  <pre><code> &lt;input type="email" name="email" id="email" value="${param.email}" class="validate"&gt;
   &lt;label for="email" data-error="Invalid Email" data-success=""&gt;Email&lt;/label&gt;
  </code></pre>
  
  <p>Each email address has to be unique, so if the email entered is a valid email address then the user would submit the form, and when processing through the java servlet it would find that the email was already used and it will cause the <code>&lt;label&gt;</code> in the jsp page to turn red once the page reloads.</p>