.
18 / 18
XX师范大学远程教育学院考查课
科目《动态网页制作》设计报告
题目在线新闻发布系统
姓名
学号
专业 计算机应用技术
批次
action="AddCommentOfNews" method="post" enctype="multipart/form-data" name="form1" id="form1">
<textarea name="commenttext" rows="15" cols="61"></textarea>
<input name="newsid" type="hidden" value="<% <<>>; %>"/>
<input name="Submit" type="submit" value="提交" />
评论功能的实现
评论管理的数据流图如下
图4-3 评论管理数据流图
评论与浏览页面:
图4-4 评论浏览添加评论页面
评论实现的事务处理相关代码:
protected void doGet<HttpServletRequest request, HttpServletResponse response> throws ServletException, IOException {
// TODO Auto-generated method stub
.
5 / 18
doPost<request, response>;
}
/**
* ***@see HttpServlet#doPost<HttpServletRequest request, HttpServletResponse response>
*/
protected void doPost<HttpServletRequest request, HttpServletResponse response> throws ServletException, IOException {
// TODO Auto-generated method stub
<"gbk">;
<"gbk">;
int newsid = <<"newsid">>;
String comment = <"commenttext">;
String comperson = <"person">;
String type = <"type">;
PrintWriter pw = <>;
<newsid>;
<comment>;
Comment comm = new Comment<>;
<comment>;
<newsid>;
<comperson>;
.
6 / 18
int result = <comm>;
if<<"new">>
{
<"?newid="+newsid>;
}
else if<<"comment">>
{
<"?newid="+newsid>;
}
else if<<"admincomment">>
{
<"admin\\?newid="+newsid>;
}
}
添加一条评论的代码为:
public class InsertComment{
public static void insert<Comment comment>
{
DBConnectPool dbp=
《新闻发布系统》设计报告. 来自淘豆网m.daumloan.com转载请标明出处.