title: addFieldError on Struts2 not displaying error on the fields
body: <p>Hi I m very new to struts2.  from some books and websites I got this example. In action class it use validate method to check logic. The method is called bcoz from the print statements. But the error is not shown near to the fields. Jst help me</p>
  
  <p><strong>Index.jsp</strong></p>
  
  <pre><code> &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
   pageEncoding="ISO-8859-1"%&gt;
  &lt;%@ taglib uri="/struts-tags" prefix="s"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Home&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;s:form action="LoginAction "&gt;
  &lt;s:textfield name="username" label="Username" /&gt;
  &lt;s:textfield name="password" label="Password" /&gt;
  &lt;s:submit value="Login"&gt;&lt;/s:submit&gt;
  &lt;/s:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Struts.xml</strong></p>
  
  <p></p>
  
  <pre><code>&lt;package name="default" extends="struts-default"&gt;
          &lt;action name="LoginAction" class="org.shammu.struts2.actions.LoginAction"&gt;
                  &lt;result name="success"&gt;/welcome.jsp&lt;/result&gt;
                  &lt;result name="input"&gt;/index.jsp&lt;/result&gt;
          &lt;/action&gt;
          &lt;action name="emptypassthrough"&gt;
                  &lt;result&gt;index.jsp&lt;/result&gt;
          &lt;/action&gt;
  
  
  &lt;/package&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>LoginAction.java</strong></p>
  
  <pre><code> package org.shammu.struts2.actions;
  
   import org.shammu.struts2.beans.LoginBean;
  
   import com.opensymphony.xwork2.ActionSupport;
  
   @SuppressWarnings("serial")
   public class LoginAction extends ActionSupport{
  
  private String username;
  private String password;
  public String getUsername() {
      return username;
  }
  public void setUsername(String username) {
      this.username = username;
  }
  public String getPassword() {
      return password;
  }
  public void setPassword(String password) {
      this.password = password;
  }
  public String execute(){
      LoginBean login = new LoginBean();
      login.setPassword(password);
      login.setUsername(username);
      if (getUsername().equals("abcd")) {
          return "success";
      } else {
          return "input";
      }
  
  }
  
  @Override
  public void validate() {
      if (username.length() &lt; 3) {
          System.out.print("user err ok");
          this.addFieldError(username, "Username Empty Pls provide");
  
      }
      if (password.length() &lt; 3) {
          System.out.print("Pass err ok");
          this.addFieldError(password, "Password Empoty provride one pkls");
      }
  
  }
   }
  </code></pre>
  
  <p>I m not considering execute method. I want jst the error msg printed near to fields... Help</p>