惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
博客园 - 【当耐特】
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recent Announcements
Recent Announcements
D
Docker
GbyAI
GbyAI
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
The Cloudflare Blog
雷峰网
雷峰网
A
About on SuperTechFans
小众软件
小众软件
博客园 - Franky
博客园 - 聂微东
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
V2EX
Engineering at Meta
Engineering at Meta
宝玉的分享
宝玉的分享
aimingoo的专栏
aimingoo的专栏
量子位
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
罗磊的独立博客
Martin Fowler
Martin Fowler
D
DataBreaches.Net
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Secure Thoughts
Project Zero
Project Zero
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
S
Schneier on Security
Blog — PlanetScale
Blog — PlanetScale
The Hacker News
The Hacker News
Spread Privacy
Spread Privacy
Security Latest
Security Latest
NISL@THU
NISL@THU
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
CXSECURITY Database RSS Feed - CXSecurity.com
J
Java Code Geeks

博客园 - 萧风的风

mac系统下Eclipse + pydev配置python Interpreter spring 整合mongodb报NoSuchMethodError错误 mybatis在spring(Controller) 中的事务配置问题 IT经理工作职责 淘宝数据魔方技术架构解析 使用 python 开发 Web Service 安装配置Django开发环境(Eclipse + Pydev) 又拍网架构-又一个用到python的网站 SQL SERVER分页写法 nhibernate的分页方法 令人崩溃的nhibernate配置 SQL Server 2008 收缩日志 清空删除大日志文件 访问IIS时,名称以无效字符开头。。。解决方案 IIS fastcgi 超时处理 Delphi错误:Stack overflow的解决方法 某公司面试是在的解决方法 关于eclipse无法自动编译的问题 Myeclipse 文件夹src下的内容、WEB-INF\classes下的内容 - 萧风的风 - 博客园 OSChina底层数据库操作的类(QueryHelper)源码
jsforum研究。一个比较简单的论坛。
萧风的风 · 2011-10-04 · via 博客园 - 萧风的风

突然想看看论坛是怎么写的。

回想起以前。用jforum。安装使用。在看看那些代码。很多。

觉得很麻烦。自己需要的论坛也没有要求那么复杂。

就是需要简单的发帖。回帖。

进行管理。就可以了。功能越简单越好。

于是发现了。jsforum。功能超级简单。

其中也发现一些问题。进行简单的修改。

首先是在web.xml添加servlet。(见附件)

没有放web.xml文件。

数据库的创建脚本里面。都是用的text字段。这个倒是不用担心最大长度。

Sql代码  收藏代码

  1. CREATE TABLE forum_forums  
  2. (id         int(10)     NOT NULL    auto_increment,    
  3.  forum_id   int(10)         NOT NULL,  
  4.  title      text        NOT NULL,    
  5.  forum_info     text        NOT NULL,   
  6.  PRIMARY KEY (id,forum_id)  
  7. );  
  8.   
  9. CREATE TABLE forum_message   
  10. (id         int(10)     NOT NULL    auto_increment,   
  11.  forum_id   int(10)     NOT NULL,  
  12.  thread_id  int(10)     NOT NULL,   
  13.  reply_id   int(10)     NOT NULL,   
  14.  message    text        NOT NULL,    
  15.  user       text        NOT NULL,    
  16.  date_time  datetime    NOT NULL,  
  17.  PRIMARY KEY (id,forum_id,thread_id,reply_id)  
  18. );  
  19.   
  20. CREATE TABLE forum_threads   
  21. (id         int(10)     NOT NULL    auto_increment,    
  22.  forum_id   int(10)     NOT NULL,      
  23.  thread_id  int(10)     NOT NULL,     
  24.  title      text        NOT NULL,    
  25.  views      int(10)     default 0,  
  26.  PRIMARY KEY (id,forum_id,thread_id)   
  27. );  
  28.   
  29. CREATE TABLE forum_users  
  30. (id     int(10)     NOT NULL    auto_increment,  
  31.  user_name  text        NOT NULL,     
  32.  password   text        NOT NULL,  
  33.  email      text         ,  
  34.  registerdate   datetime     ,  
  35.  type   text ,  
  36.  avatar     text         ,  
  37.  member_title   text         ,  
  38.  signature  text         ,  
  39.  PRIMARY KEY (id)  
  40. );  
  41.   
  42. CREATE TABLE forum_settings  
  43. (id     int(10)     NOT NULL    auto_increment,  
  44.  dbName     text        NOT NULL,     
  45.  dbLogin    text        NOT NULL,  
  46.  dbPassword text        NOT NULL,  
  47.  forumPath  text        NOT NULL,  
  48.  forumName  text        NOT NULL,  
  49.  messagePerPage text        NOT NULL,  
  50.  PRIMARY KEY (id)  
  51. );  

 数据库里面forum_user里面少了一个type字段。

在数据java类里面也有过小小的问题。mysql的驱动定义。

Class.forName("com.mysql.jdbc.Driver");

在执行的时候的方法也不对。

Java代码  收藏代码

  1. public void query(String SQLQuery){  
  2.     this.SQLQuery = SQLQuery;  
  3.     try {  
  4.         stmt = conn.createStatement();  
  5.         <span style="color: #ff0000;">stmt.executeQuery( SQLQuery );</span>  
  6.   
  7.     }  
  8.     catch( Exception e ){}  
  9. }  

 这个应该是:

Java代码  收藏代码

  1. public void query(String SQLQuery) {  
  2.     System.out.println(SQLQuery);  
  3.     this.SQLQuery = SQLQuery;  
  4.     try {  
  5.         stmt = conn.createStatement();  
  6.         <span style="color: #ff0000;">stmt.executeUpdate(SQLQuery);</span>  
  7.   
  8.           
  9.     } catch (Exception e) {  
  10.         e.printStackTrace();  
  11.     }  
  12. }  

 明明就是是数据库插入删除的的操作。名字是query。应该叫executeXXX什么吧。

总之修改了之后。是可以用来。

注意字段的not null属性,因为之前调试了半天,最后发现是由于数据库的影响,导致stmt.executeUpdate()总是执行不成功。