title: dto and dao implementation
body: <p>code on the click event of the button </p>
  
  <pre><code> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt){                                         
  
    String login, password;
  
     login = jTextField1.getText().trim();
     password = jTextField2.getText().trim();
  
      System.out.println("hello");   
      RegisterDAO r = new RegisterDAO();
      r.insert(login, password);
  
  
  }  
  </code></pre>
  
  <p>code for the dao class </p>
  
  <pre><code> public class RegisterDAO {
  
   private String login, password;
  
  public void insert(String login ,String password)
  {
      this.login= login;
      this.password = password;
  
      RegisterDTO r = new RegisterDTO();
      r.setLogin(login);
      r.setPass(password);
  
   java.sql.Connection con = new DBConnection().getConnection();
     if (con!=null){
      System.out.println("the connection object is active ");
  
      PreparedStatement pst;
      String Q;
      int x=1;
  
      Q="insert into x(a,b) values(?,?)";
     try {
     pst=con.prepareStatement(Q);
     pst.setString(x++, login );
     pst.setString(x++,password);
  
     int a=pst.executeUpdate();
       System.out.println(a);
  
      }
      catch (Exception ex )
      {
          ex.printStackTrace();
      }
  //JOptionPane.showMessageDialog(null, s, s, x, null);
  }                  
  </code></pre>
  
  <p>my dto class </p>
  
  <pre><code> public class RegisterDTO {
  private String a;
  private String b;
  public void setLogin(String a)
  {
      this.a = a ;
      System.out.println(a);
  }
  public String getLogin()
  {
      return a;
  }
  public void setPass(String b)
  {
      this.b = b;
      System.out.println(b);
  
  }
  public String  getPass()
  {
      return b;
  }       
  </code></pre>
  
  <p>1)my problem is that i am not able to retain the values that is stored in the dto class by the setter and the getter methods . what are the ways to get the value using the dto.
  i also want  to access the value on the on other   page but i am not able to get that value the print statement in the dto class shows that the value is stored in the variable 
  the application i am creating is of the swing based and i don't know that is swing support the sessions management, if it support the session than help me to implement that. </p>
  
  <p>2)i  want to know that the approch that i am following in the case  of the DAO and DTO is proper or not </p>
  
  <p>3)i  want to know that to access the dto to the each and every page do i need to create the object of the dto to access that, if that is the case does it result in the ambiguity as the multiple object created </p>
  
  <p>4)can i be able to directly access the value that is stored in the dto by the getter method( without data base access ). i have created the ret() method to retrieve the data from the data base in my dao class </p>
  
  <pre><code>    public void ret(String login  )
  {
      login= this.login ; 
  
        java.sql.Connection con = new DBConnection().getConnection();
     if (con!=null){
      System.out.println("the connection object is active ");
  
      PreparedStatement pst;
      String Q;
      int x=1;
  
      Q="select * form x where a=?";
     try {
     pst=con.prepareStatement(Q);
         pst.setString(x++, login );
  
  
         ResultSet rs= null;      
          rs = pst.executeUpdate();
  
  
  }
  </code></pre>
  
  <p>the above code result in the error that the result set is not able to handle the integer out of the executeUpdate() methods . do i need to cast for that purpose as i am not able to figure it out how the integer value is cast into the result set . i also want to know that how to access the individual fields as the result set displays the whole tuple . how the result set is able to store the values to the individual fields of the getter methods </p>