Hi all,

I am designing a login page in gwt.
Following Login class holds the user interface for getting username
and password

public class Login extends Composite {

        private static Button signInButton;
        private CheckBox rememberMeOnCheckBox;
        public TextBox textBoxPassword;
        public TextBox textBoxUsername;
        private Label passwordLabel;
        private Label usernameLabel;
        private FlexTable flexTable;
        private Label signInToLabel;
        private VerticalPanel verticalPanel;
        public Login() {

                verticalPanel = new VerticalPanel();
                initWidget(verticalPanel);

                signInToLabel = new Label("Sign in to your account.");
                verticalPanel.add(signInToLabel);

                flexTable = new FlexTable();
                verticalPanel.add(flexTable);

                usernameLabel = new Label("Username:");
                flexTable.setWidget(0, 0, usernameLabel);

                passwordLabel = new Label("Password:");
                flexTable.setWidget(1, 0, passwordLabel);

                textBoxUsername = new TextBox();
                flexTable.setWidget(0, 1, textBoxUsername);

                textBoxPassword = new TextBox();
                flexTable.setWidget(1, 1, textBoxPassword);

                rememberMeOnCheckBox = new CheckBox();
                flexTable.setWidget(2, 1, rememberMeOnCheckBox);
                rememberMeOnCheckBox.setText("Remember me on this computer.");

                signInButton = new Button();
                flexTable.setWidget(3, 1, signInButton);
                signInButton.addClickListener(new ClickListener() {
                        public void onClick(Widget sender) {
                                if (textBoxUsername.getText().length() == 0 ||
                                                
textBoxPassword.getText().length() == 0) {
                                        Window.alert("Username or password is 
empty.");
                                }
                                else
                                {
                                        //once the user name and the password 
is right
                                       //it comes here

                                }
                        }
                });
                signInButton.setText("Sign In");
        }

}

actually, for validating it from the database i need to transfer the
username and password textbox value to another java class for database
connectivity..so, can anyone help me in transferring the data from
Login class and ValidateLogin class(its listed below)

public class ValidateLogin {

        Backend bk = new Backend();
        DataSet ds = null;

        public static void main(String[] args)
        {
                Login log = new Login();
                String query="select * from users where
username='"+log.textBoxUsername.getText()+"'";
                query+=" and password='"+log.textBoxPassword.getText()
+"'";
                ds=bk.executeQuery(query);
                if(ds.rowCount()!=0)
                        //correct login
               else
                       //incorrect login
        }
}

Thanks in advance,
-Sharma.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to