java实现简单留言板功能的代码实例
数据库对应的表:
guestbook:id ,name,phone,email,title,content,time; id
新建web project:guestbook
build Path:引入连接数据库的驱动的类库
在webRoot目录中加入:
+faceditor
+js
web.xml
代码:
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
AddMessageServlet
webbook.guestbook.AddMessageServlet
GetMessagesServlet
webbook.guestbook.GetMessagesServlet
AddMessageServlet
/servlet/addMessage
GetMessagesServlet
/servlet/getMessages
addMessage.htm
代码:
add message请您输入留言
姓名: | |
E-Mail: | |
电话: | |
主题: | |
内容: | var oFCKeditor = new FCKeditor("content"); oFCKeditor.BasePath = '/guestbook/fckeditor/' ; oFCKeditor.Height = 300 ; oFCKeditor.ToolbarSet = 'Basic'; oFCKeditor.Create() ; |
content.html
display content留言内容
编号 | 12 |
姓名 | liuwei |
电话 | 2922266 |
phpa@www.3ppt.com | |
主题 | you can test |
内容 | test content! |
编号 | |
姓名 | |
电话 | |
主题 | |
内容 |