Js|servlet| user registers the software and operating environment required by this example:
1. Windows2000 Server operating system
2, jdk1.4
3, JCreator2.5 (Java source Edit debugger)
4, Macromedia JRun MX
5, Macromedia Dreamweaver MX (not required)
6, MySQL database (preferably installed MySQL control Center)
first, the database design With MySQL control center open the MySQL database, create a new database shopping, under which the new table Tbl_user, where the fields are set as follows:
Second, write the connection database Bean:DBConn.java Dbconn.java
Include Required classes
Import java.sql.*;
//==========================================
Define Class Dbconn
//==========================================
public class Dbconn
{
Public String sql_driver = "Org.gjt.mm.mysql.Driver";
Public String Sql_url = "jdbc:mysql://localhost:3306";
Public String sql_dbname = "shopping";
Public String user = "sa";
Public String pwd = "";
Determine if there is information in the result set
public boolean hasData ()
{
try{
Boolean has_data = This.rs.first ();
This.rs.beforeFirst ();
return has_data;
}catch (SQLException e) {
System.out.println (E.tostring ());
return false;
}
}
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.