Simple login example implemented by pure JSP and jsp login example

Source: Internet
Author: User

Simple login example implemented by pure JSP and jsp login example

This article describes the simple login method implemented by pure JSP. We will share this with you for your reference. The details are as follows:

There are four files: web. xml, login. jsp, logout. jsp, and welcome. jsp.

Test environment: Tomcat 6.0.x

Assume that the project name is LoginSample, and my directory structure is as follows:

... \ Webapps \ LoginSample \ WEB-INF \ web. xml
... \ Webapps \ LoginSample \ login. jsp
... \ Webapps \ LoginSample \ logout. jsp
... \ Webapps \ LoginSample \ welcome. jsp

Web. xml source code list:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"version="2.4">  <welcome-file-list>    <welcome-file>welcome.jsp</welcome-file>  </welcome-file-list></web-app>

Login. jsp Source Code List:

<% @ Page contentType = "text/html; charset = UTF-8 "%> 

Logout. jsp Source Code List:

<% @ Page contentType = "text/html; charset = UTF-8" %> 

Welcome. jsp Source Code List:

<% @ Page contentType = "text/html" pageEncoding = "UTF-8" import = "java. util. * "%> 

I hope this article will help you with JSP program design.

Related Article

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.