说明:用jsp+mysql数据库创建留言本,首先要创建mysql数据库,关于mysql的使用请到 http://pinghui.51.net/download/012mysql.chm 下载教程。现在为了说明的需要,我们假设数据库已经建立完成,数据库的名称是pinghui,其中有comment表是记录留言信息的。
数据库的结构为:
+-----------+-------------+------+-----+---------------------+----------------+
field type null key default extra
+-----------+-------------+------+-----+---------------------+----------------+
userid int(11) pri 0 auto_increment
username char(20)
sex char(2)
address char(40) yes null
ip char(15)
post int(11) yes 0
oicq int(11) yes 0
icq int(11) yes 0
telnumber char(30) yes null
comment text null
time datetime 0000-00-00 00:00:00
+-----------+-------------+------+-----+---------------------+----------------+
如果你认为建立数据库太麻烦的话
建立数据库的语句为:
drop database if exists pinghui;
create database pinghui;
use pinghui;
create table comment(
userid int not null default 0 auto_increment primary key,
username char(20) not null,
sex char(2),
address char(40),
ip char(15) not null,
post int default 0,
oicq int default 0,
icq int default 0,
telnumber char(30),
comment text not null,
time datetime not null
);
insert into comment (username,ip,comment,time) values ("pinghui","127.0.0.1",
"你好,请到萍慧自由空间查看信息!",now());
insert into comment (username,sex,address,ip,post,oicq,icq,telnumber,comment,time)
values ('pinghui','男','地址','127.0.0.1',250100,2269101,74875874,'0531-8605449',
'你好,请到萍慧自由空间查看留言!谢谢!',now());
有了数据库下面我们的讲解会更方便的。 继续留言本的建立
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器