How can I make login page with java applet !

MonPhu
MonPhu used Ask the Experts™
on
Hello,
     I need to do the Login page ( username ( bedside user name I need one drop-down box ) and password field ! I can only write it with jsp but i don't know how to do with java applet !
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hi,

   if you want to do the Login Page with Applet, then you need to know that AWT or Java Swing. How to create/add a button, and how to add a listener to it. Try to read the java tutorial to get more information :

http://java.sun.com/docs/books/tutorial/applet/index.html

Basically, what your applet need to do are :

1) add "User Name" Label
2) add a TextField for user name.
3) add "Password" Label.
4) add a TextField for password
5) add a "Sumit" Button
6) add ActionListener to the "Submit" button.
7) within the ActionListener function, do some data validation and then check the user name and password from the database.
8) redirect to the success page if valid user else show "Invalid User Page".

hth,
Kok Choon.

Author

Commented:
Thanks for your comment. But i can't use data base for my project .So is there any other way to do login applet ?
Take Note: i'm using javax.swing
----------------------------------------------------------

to create JTextField:
---------------------
JTextField pswdTxt = new JTextField (5);
//the number in the brackets can be changed
//it determines the length of the textfield

to create a password field:
---------------------------
JPasswordField pswdField = new JPasswordField (5);
//the number in the brackets can be changed
//it determines the length of the textfield
//the string input will be in the form of ******

to create a JComboBox:
----------------------
JComboBox comboBox = new JComboBox ();
//this is the default, with no values in it

to add values into the combo box:
---------------------------------
comboBox.addItem("Testing");
//this is to add the string 'testing' into the combo box

int[] integerArray = {5, 6, 7, 8};
for (int i=0; i<integerArray.length; i++) { comboBox.addItem ("" +integerArray[i]); }
//this is to convert the integers 5, 6, 7, 8 to strings
//and then add them into the combo box
//we cannot add primitive types into a JComboBox
//i.e integers, double etc.

pardon me if the codes are too messy
:)
-=[sKySh@DoW]=-
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

//create a static string for your password

static string password = "testing";

//then grab the string from the password field

string pswdInput = pswdField.getPassword();
if (pswdInput.equalsIgnoreCase(password))
//login successful
else
//login failed

Commented:
How did you do this with JSP? May be this can help us to offer you a similat solution with an applet.

Author

Commented:
Hello Sky ! Thanks for your comment and i'll accept it as answer ! I do appreeciate your help !
thanks .. glad to noe that i was of some help .. thks for the points

:)
-=[sKySh@DoW]=-

Author

Commented:
Sky !
    I got one problem ! I can't use java swing in my project ! So can use pls help me again ! Thanks !

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial