Simple User Login website (HttpServlet1.2 version)

Source: Internet
Author: User

Case Description: When the user has not logged in to access the Welcome screen, the page jumps to the login screen, and displays the prompt message;

If the user fill in the information is inconsistent with the fixed user information, the login screen display error message, otherwise jump to the Welcome page, display the user name information.

New Login2.java-User login interface, when the user information input error, will display a reminder message. (When the user directly accesses the Welcome interface, if the user's session does not exist, then jump to the login screen to remind users not to log in)

Servlet Deployment for Login2.java

New Logincl2.java-The user input information to verify, if the user information is correct, add the session and its properties, if necessary, set the time of the session, and jump to the welcome interface; If the user fills in the wrong information, the login screen displays an error alert.

Servlet Deployment for Logincl2.java

New Wel2.java-Welcome interface (detects whether a session of a property exists, if not empty is present, the welcome message is displayed, otherwise jump to the login screen and display the Error alert message)

servlet deployment for Wel2.java

turn on Tomcat, Access 127.0.0.1:8080/myweb-site/wel2 on your browser, page display jumps to login screen and displays error alerts , as follows:

Fill in the user information (the user name and password are incorrect), the page effect is as follows: (User name or password error effect self-operation)

Enter the correct user information, jump to the Welcome screen, the effect is as follows:

If you refresh the page again within 20s of the session, the page will be the same, and if you refresh the page after 20s, the page effect is as follows:

Simple User Login website (HttpServlet1.2 version)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.