Implementation of the Forum tree structure of the algorithm many, specific you can go to www.chinaasp.com full-text search query. My current JSP forum is also one of the following: Do not have to implement the tree structure of the algorithm, now I will be the forum tree structure of the specific algorithm and you introduce, and everyone to communicate.
1. The structure of the demo table:
Table Name: mybbslist
Field
Data type
Description
BBSID Automatic Numbering
Rootid Int Root Post ID, which itself is the root post Rootid = ID
FID INT parent Post ID, the ID of the previous post, if the root thread fid = 0
DEPTH Int Root Post level=0, other depending on the depth of the reply increment
Bbssubject Char Theme
2. To create a table:
CREATE TABLE Mybbslist (
ForumID int () NOT NULL,
BBSID int Auto_increment primary KEY,
Rootid int () NOT NULL,
FID int (.) NOT NULL,
depth int () NOT NULL,
UserID int () NOT NULL,
Bbsuser varchar () NOT NULL,
Bbssubject varchar (m) NOT NULL,
Bbscontent text,
Bbstime varchar (30),
Bbsread Int (20),
bbsreply Int (20),
INDEX ForumID (ForumID))
3. Beans that connect to the MySQL database
Package NetZero;
Import java.sql.*;
public class MyDB
{
String drivername = "Org.gjt.mm.mysql.Driver";
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String connurl= "Jdbc:mysql://localhost/mybbs?user=root&password=how&useunicode=true&characterencode =8859_1 ";
String connurl= "Jdbc:mysql://localhost/netzerobbs?user=root&password=how";
Public MyDB ()
{
Try
{
Class.forName (drivername);
}
catch (Java.lang.ClassNotFoundException e)
{
System.err.println ("NetZero (String):" + e.getmessage ());
}
}
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.