Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8501173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:08:09+00:00 2026-06-11T01:08:09+00:00

I am writing a web application in java that has two different type of

  • 0

I am writing a web application in java that has two different type of users Student & Staff. I want one centralized login for all users but Students must view a different page from teachers .The way I currently implement this is by using one login form and take the username & password and run two queries, one on the student table and one on the staff table. If I get successful response from the user table then I login the user to the student page, otherwise I query the teacher table if I get a successful result I login to the Teachers page, otherwise I give error message that username and password is invalid. What I would like to know is how can I improve this is doing just one query possible and I don’t mind editing the database to facilitate this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:08:11+00:00Added an answer on June 11, 2026 at 1:08 am

    This is too open-ended for a definitive answer, but it’s common to separate authentication from authorization.

    One approach to doing this is to have a table of users and a table of roles, with the user table handling authentication and the role table controlling authorization. A user is associated with a role (or maybe even multiple roles) by a join table.

    With this approach, login does a query against only the user table to determine that a person is a valid user, and other parts of the application query the role or roles associated with the logged-in user to determine whether access to a specific function is allowed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Java SE (desktop) application that has to access different databases all
I usually C++ applications. The only web-application development I've done is writing Java Applets.
When writing a web application which allows the upload of files, one must be
I'm writing a web application that connects to a database. I'm currently using a
I am writing a web application that takes a script input from a client-side
I am writing a web-application using Play 1.2.3 . One of the feature is
I'm writing a web application and need to initialize some parameters that I'm pulling
I am writing a Java application that requires access to a database, which is
I'm writing a Java application that will run for a long time (essentially, it
I'm developing a java servlet web application that manages information from multiple databases (all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.