title: What's the point of beans?
body: <p>I've bean doing some JSP tutorials and I don't understand what the point of a bean class is. All it is, is get and set methods. why do we use them?</p>
  
  <pre><code>public class UserData {
  
  String username;
  String email;
  int age;
  
  public void setUsername( String value )
  {
      username = value;
  }
  
  public void setEmail( String value )
  {
      email = value;
  }
  
  public void setAge( int value )
  {
      age = value;
  }
  
  public String getUsername() { return username; }
  
  public String getEmail() { return email; }
  
  public int getAge() { return age; }
  </code></pre>
  
  <p>}</p>
  
  <p>and the jsp is</p>
  
  <pre><code>&lt;jsp:useBean id="user" class="user.UserData" scope="session"/&gt; 
  &lt;HTML&gt;
  &lt;BODY&gt;
  You entered&lt;BR&gt;
  Name: &lt;%= user.getUsername() %&gt;&lt;BR&gt;
  Email: &lt;%= user.getEmail() %&gt;&lt;BR&gt;
  Age: &lt;%= user.getAge() %&gt;&lt;BR&gt;
  &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>