JSP basic syntax <2>: JSP + JDBC user login program implementation, jspjdbc
1.1 create a database table
Table Name: user
Field:
Userid: Save the user's logon id
Name Username
Password
1.2 Implementation ideas
A. User Logon requires a table sheet page on which the user's logon id and password can be entered;
B. submit it to a verified jsp page for database operation verification. If user information can be queried, it is a legal user, and the logon success page is displayed;
C. If no query is found, the user is not a legal user, and the error page is displayed;
1.3 Program Implementation
Login. jsp: provides a user login form that allows you to enter the login id and password;
<% @ Page contentType = "text/html" pageEncoding = "GBK" %>
Login_check.jsp: logon check page. The information submitted in the root form is verified. The logon success page is displayed. Otherwise, the error prompt page is displayed;
<% @ Page contentType = "text/html" pageEncoding = "GBK" %> <% @ page import = "java. SQL. * "%>
The login_success.jsp logon success page displays the welcome information;
<% @ Page contentType = "text/html" pageEncoding = "GBK" %>
Login_failure.jsp: logon Failure page, prompting the user to enter an error and providing a hyperlink to log on again;
<% @ Page contentType = "text/html" pageEncoding = "GBK" %>