wood burning stoves 2.0*
The moose likes JSP and the fly likes Selecting which user is login Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Selecting which user is login" Watch "Selecting which user is login" New topic
Author

Selecting which user is login

Ahesanali Khanusiya
Greenhorn

Joined: Jul 15, 2010
Posts: 11
Hello,

I am making one application in which 3 users are there. I am confused at the time login how can i know that which user is login and which page I have to call and also tell me primary key and foreign key of table. my users are: STUDENT,FACULTY,ADMIN if possible than explain with some example.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

How can we tell you what the primary and foreign keys of your table are?

At login time the person logs in giving (presumably) a username and password--that's how you know who's logging in. They tell you.

Are your *users* "STUDENT", "FACULTY", and "ADMIN", or are those the *types* of users?
Ahesanali Khanusiya
Greenhorn

Joined: Jul 15, 2010
Posts: 11
yes they are types of user...one table of user in which userid-pk and usertype fields another table login in which loginid-pk,username,password and userid-fk third is register in which sign up detail and loginid-fk
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I guess I'm not sure what the question is then.
Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 274

You should have a "users" table in the database with a "role" column that stores whether they are a student, faculty, or admin. Then, when they login, you use the username and password they entered to find the row that represents the user in the table. Use the value of the "role" column to determine what kind of user they are.


SCJP 6 || SCWCD 5
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

if I understood you right it would be like:


I know the code is ugly but it is just to give you an idea.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Selecting which user is login