How tu use a login screen using a servlet and then verify the user info in the DB

Posted on 2007-10-17
Last Modified: 2013-11-24
I have a html page who gives the user  two options to click on, I want to use a login screen and a verify that information in my table from a DB. These two servlets are protected for the same session, so I want to share the DB connection.How to proceed?
Thank you
Question by:Mimi1979
    1 Comment
    LVL 5

    Accepted Solution

    Best option is to create one Servlet that handles both requests.  You can the use the single DB connection for both without much trouble.

    Option two is to have your DB connection use static varriables so that it is available to any instance of a particular class.  You could then create a single class that handles database connections.  Any new class that creates an instance of this class would then have database connection (as long as the first instance created sucessfully connects to the database)

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    matchUp  challenge 9 51
    bigHeights  challenge 13 43
    bunnyEars challenge 6 45
    return in catch statement 1 32
    Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
    One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now