How to retrieve and display a login id after successful login
<p>I have a problem in retrieving the exact user login Id after the login has been successful, and to display it on a status text-box in my admin frame </p>

<pre><code>public String i;
public  String getId()
{
    return this.i;
}   
private void btnLogActionPerformed(java.awt.event.ActionEvent evt) {                                       
    String sql ="select * from ad where logId=? and password=?";
    try{
        pst = conn.prepareStatement(sql);
        pst.setString(1,loginTxt.getText());
        pst.setString(2,passTxt.getText());

        rs = pst.executeQuery();
        if(rs.next())
        {
            JOptionPane.showMessageDialog(null, "Username and password is correct"); i = rs.getString("logId");
            rs.close();
            pst.close();
            AdminTable s = new AdminTable();
            s.setVisible(true);
            dispose();
        }
        else
        {
            JOptionPane.showMessageDialog(null, "Username and password incorrect");
        }
    }
    catch(Exception e)
    {
        JOptionPane.showMessageDialog(null, e);
    }

}   
</code></pre>

<p>//This is my second frame, the admin frame. i want the login Id to appear on a textbox automatically after the user has logged in 
  <code>Login lo = new Login();
    public Admin() {
        initComponents();
       jTextAdId.setText(lo.i);
    }
</code></p>