Electronic address book
I. Electronic communication Bo application requirements:
1) Safe login
2) Add friend contact address
3) Query the contact address of good friends according to the conditions
4) List all good friends contact address list
5) Safety logout
Second, page description:
1. Login.JSP login interface, query the database for user authentication, unregistered refusal to log in.
2. Main.jsp Main page, displayed to add a friend contact address page, list all good friends contact address pages, query the link to contact the address page and securely login.
3. INSERT.JSP Add Friends Contact Address Page to enter new friends information, including friends name, friend address, friend phone number, click OK to click OK to save to the database
4. DisplayAll.jsp lists the details of all friends, including name, address, phone number
5. Search.jsp Users enter query information, perform fuzzy queries, including user names, addresses, phone numbers, and display the results in the DisplaySearch.jsp interface.
6. DisplaySearch.jsp Generates a SQL query statement according to the query information passed by Search.jsp, and calls SearchBean.java's search () method returns a result set, display the result.
7. Logoff.jsp makes the session, page forwarding the login interface.
8. InvalIDanceSession.jsp login verification interface, is included in the middle of the above 2, 3, 4, 5, and 6 pages, verify that the user logins, if it is not returned to the login interface.
Third, Java file description:
1. INSERTBEAN.JAVA is used to perform the business logic inserted into the database using the insert.jsp using the insert () method.
2. SearchBean.java's search () method is used to accept the SQL statement sent from Search.jsp, querying the database to package the result package in HashTable.
Fourth, database table design:
Address_Table
Field Type
ID INT (4)
Name char (25)
Phone char (10)
Address Char (50)
Password char (10)
V. Access the tools used by the database:
Package com.jspdev.util;
Import java.sql. *;
Import javax.naming. *;
Import javax.sql.datasource;
// A tool class for finding a data source.
Public class databaseconn {
Public Static Synchronized Connection getConnection () THROWS EXCEPTION
{
Try
{
Context initctx = new javax.naming.initialcontext ();
Context envctx = (context) INITCTX.LOOKUP ("Java: Comp / ENV");
DataSource DS = (DataSource) Envctx.lookup ("JDBC / JSPDEV"); return DS.GetConnection ();
}
Catch (SQLException E)
{
Throw e;
}
Catch (Namingexception E)
{
Throw e;
}
}
}