In order to practicing, I have tried to do a website login and registration of a small case. Because there is no landscaping processing, so the interface is not very good-looking.
The functions of Web site implementation are as follows:
• User first registration function
• User Login function
I'll show you the module below.
Registration module
First you need a registration interface, as follows register.jsp:
<%@ page language= "java" contenttype= "text/html" Charset=utf-8 "pageencoding=" Utf-8 "%> <!
DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
The
Then is the registration processing page for the action, as follows do_register.jsp:
<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "pageencoding=" utf-8 "%> <%@ page import=" java.sql.* "%> <!
DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
Small summary:
Deficiencies:
• For the operation of the database is not good enough, there is no timely use of resources to shut down, should be timely for those unused open resources to close operations, release resources.
• The interface effect is not good enough, response output is prior to out of the output.
• Database operation is too cumbersome, should be integrated, do a special processing database Operations Toolkit to achieve good reuse of code!
Login Module
The first is the login interface, login.jsp, I added a hyperlink (intention is to let login.jsp as a portal page, to achieve registration of the effect of a single, although the two are not combined, and the registration interface is too simple), we first gather together to see it.
<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "pageencoding=" Utf-8 "%> <!
DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
Then the processing page for the logon information, do_login.jsp:
<% @page import= "Java.sql.DriverManager"%> <%@ page language= "java" contenttype= "text/html; Charset=utf-8 "pageencoding=" utf-8 "%> <%@ page import=" java.sql.* "%> <!
DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
For landing successful users, jump to the successful landing interface login_success.jsp:
<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "
pageencoding=" Utf-8 "%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
For users who fail to login, make a warm page prompt, login.failed.jsp:
<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "
pageencoding=" Utf-8 "%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
Big Summary:
The progress of the Department:
• Use of the Session object to store the user login name information, to achieve the information between the page interaction
• With MySQL, to a certain extent experience the JEE mode
Deficiencies:
• The code is too cumbersome and not good for reuse
• Resource utilization is not high, the use of unused resources to be closed in a timely manner. Although the Java Virtual machine has automatic garbage collection mechanism, but it is best to develop good habits!
• Interface control is not good enough, poor experience, lack of thinking
Where to improve:
• With a more complex user registry, it's better to do it in a bean way
• Modularity, using the concept of MVC
• Improve interface permissions to prevent hotlinking
• Add other features such as uploading files, downloading files, and enriching the site.
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.