JSP _ implements Servlet login, registration, and connection to Mysql database. Http://blog.csdn.net/svitter in this article
It is also an MVC instance.
Source code: http://download.csdn.net/detail/svitter/7532621
User. SQL:
-- PhpMyAdmin SQL Dump -- version phpStudy 2014 -- http://www.phpmyadmin.net---- Host: localhost -- generation date: June 21, 2014 -- Server version: 5.5.38 -- PHP version: 5.3.28SET SQL _MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+ ";/*! 40101 SET @ OLD_CHARACTER_SET_CLIENT = @ CHARACTER_SET_CLIENT */;/*! 40101 SET @ OLD_CHARACTER_SET_RESULTS = @ CHARACTER_SET_RESULTS */;/*! 40101 SET @ OLD_COLLATION_CONNECTION = @ COLLATION_CONNECTION */;/*! 40101 set names utf8 */; ---- database: 'users' ---- orders TABLE structure 'Ur '-- create table if not exists 'Ur' ('name' varchar (255) not null, 'passwd' varchar (255) not null, 'id' bigint (20) not null AUTO_INCREMENT, primary key ('id ')) ENGINE = MyISAM default charset = gbk AUTO_INCREMENT = 2; ---- 'ur' -- insert into 'ur' ('name', 'passwd', 'id ') VALUES ('A ',' A', 1 );/*! 40101 SET CHARACTER_SET_CLIENT = @ OLD_CHARACTER_SET_CLIENT */;/*! 40101 SET CHARACTER_SET_RESULTS = @ OLD_CHARACTER_SET_RESULTS */;/*! 40101 SET COLLATION_CONNECTION = @ OLD_COLLATION_CONNECTION */;
Web. xml:
JSP_servlet_javabean
Configure the Servlet used for login logging
LoginServlet
LoginServlet
LoginServlet
LoginServlet
/LoginServlet
Configure the Servlet used for registration with slave
RegisterServlet
RegisterServlet
RegisterServlet
RegisterServlet
/RegisterServlet
Login.html
Lib:
Mysql-connector-java.jar;
Mysql-connector-java-5.1.17.jar;
Login.html:
Login.html
LoginCheck. jsp:
<% @ Page language = "java" contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %>
Insert title here<% String checkLogin = (String) (request. getAttribute ("checkLogin"); %>