Web课程设计报告书.docx
- 文档编号:28845004
- 上传时间:2023-07-20
- 格式:DOCX
- 页数:60
- 大小:636.10KB
Web课程设计报告书.docx
《Web课程设计报告书.docx》由会员分享,可在线阅读,更多相关《Web课程设计报告书.docx(60页珍藏版)》请在冰豆网上搜索。
Web课程设计报告书
《Web课程设计》
课程设计报告书
设计题目microblog信息系统
专业班级xxxxx
学号xxxxxxxxx
指导老师xxxxxxx
设计日期xxxx年x月x日
前言
Microblog信息系统主要是一个校园微博系统,在该系统中可以注册、登
录,同时还分普通会员登录及管理员登录。
通过登录后,可实现发布、查
询、删除微博等各项功能。
关键字:
信息系统微博登录
系统分析
1.设计目的:
1.综合应用java程序设计、WEB程序设计、数据库应用、计算机网络等知识设计和实现我校MicroBlog信息系统。
2.通过上述设计和实现,加深对java程序设计、WEB程序设计、数据库应用、计算机网络相关理论的理解,锻炼综合应用所学知识分析问题和解决问题的能力。
3.培养软件开发的团队协作精神。
系统设计
1.设计容:
(1)用户注册
(2)用户登录(分一般用户和管理员)
(3)某用户发布微博信息
(4)浏览所有用户的微博信息
(5)浏览指定用户的微博信息
(6)查询某些用户或(且)某时间段或(且)某论题的微博信息。
(7)删除某些用户或(且)某时间段或(且)某论题的微博信息。
(8)统计分析某时间段的用户数量,微博数量。
(9)发布重大消息或提示信息
(7-9基于管理员)
2.设计环境:
(1)完整实现设计容所指定的功能
(2)应用服务器采用Tomcat6.0或以上
(3)基于JSP编程
(4)开发工具采用Eclipse+DreamWeaver
(5)数据库采用ACCESS2003
(6)用户界面友好
3.系统流程图:
数据库设计
在Microblog信息系统中,共设计3表。
本系统使用Access来创建数据表。
数据库的名称为WEB.mdb,三表分别为admin、message、user。
表:
admin
表:
message
表:
user
系统实现代码
Login.java
packagemybean.data;
publicclassLogin
{Stringlogname,
password,
backNews="";
booleansuccess=false;
publicvoidsetLogname(Stringname)
{logname=name;
}
publicStringgetLogname()
{returnlogname;
}
publicvoidsetPassword(Stringpw)
{password=pw;
}
publicStringgetPassword()
{returnpassword;
}
publicStringgetBackNews()
{returnbackNews;
}
publicvoidsetBackNews(Strings)
{backNews=s;
}
publicvoidsetSuccess(booleanb)
{success=b;
}
publicbooleangetSuccess()
{returnsuccess;
}
}
Message.java
packagemybean.data;
publicclassMessage{
Stringlogname="",message="",time="",title="",backNews;
publicvoidsetLogname(Stringname)
{logname=name;
}
publicStringgetLogname()
{returnlogname;
}
publicvoidsetTitle(Stringt)
{title=t;
}
publicStringgetTitle()
{returntitle;
}
publicvoidsetTime(Stringt)
{time=t;
}
publicStringgetTime()
{returntime;
}
publicStringgetMessage()
{returnmessage;
}
publicvoidsetMessage(Stringm)
{message=m;
}
publicStringgetBackNews()
{returnbackNews;
}
publicvoidsetBackNews(Strings)
{backNews=s;
}
}
Register.java
packagemybean.data;
publicclassRegister
{Stringlogname="",password="",qq="",
email="",phone="";
StringbackNews;
publicvoidsetLogname(Stringname)
{logname=name;
}
publicStringgetLogname()
{returnlogname;
}
publicvoidsetQq(Stringq)
{qq=q;
}
publicStringgetQq()
{returnqq;
}
publicvoidsetPassword(Stringpw)
{password=pw;
}
publicStringgetPassword()
{returnpassword;
}
publicvoidsetEmail(Stringem)
{email=em;
}
publicStringgetEmail()
{returnemail;
}
publicvoidsetPhone(Stringph)
{phone=ph;
}
publicStringgetPhone()
{returnphone;
}
publicStringgetBackNews()
{returnbackNews;
}
publicvoidsetBackNews(Strings)
{backNews=s;
}
}
ConditionQuery.java
packagemybean.data;
importjava.sql.*;
publicclassConditionQuery
{Stringlogname;
StringBufferqueryResultBylogname;
publicConditionQuery()
{queryResultBylogname=newStringBuffer();
try{Class.forName(".microsoft.sqlserver.jdbc.SQLServerDriver");
}
catch(Exceptione){}
}
publicvoidsetlogname(Strings)
{logname=s.trim();
queryResultBylogname=newStringBuffer();
}
publicStringgetlogname()
{returnlogname;
}
publicStringBuffergetQueryResultBylogname()
{Stringcondition="SELECT*FROMmessageWherelogname='"+logname+"'";
queryResultBylogname=f(condition);
returnqueryResultBylogname;
}
privateStringBufferf(Stringcondition)
{StringBufferstr=newStringBuffer();
Connectioncon;
Statementsql;
ResultSetrs;
try{Stringuri="jdbc:
sqlserver:
//127.0.0.1:
1433;DatabaseName=factory";
con=DriverManager.getConnection("jdbc:
odbc:
4073","","");
sql=con.createStatement();
rs=sql.executeQuery(condition);
str.append("
str.append("
str.append("
str.append("
str.append("
while(rs.next())
{str.append("
str.append("
(1)+"
str.append("
(2)+"
str.append("
str.append("
str.append("
}
str.append("
con.close();
}
catch(SQLExceptione)
{System.out.println(e);
}
returnstr;
}
}
HandleAdmin.java
packagemyservlet.control;
importmybean.data.*;
importjava.sql.*;
importjava.io.*;
importjavax.servlet.*;
importjavax.servlet.http.*;
publicclassHandleAdminextendsHttpServlet
{publicvoidinit(ServletConfigconfig)throwsServletException
{super.init(config);
try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(Exceptione){}
}
publicStringhandleString(Strings)
{try{bytebb[]=s.getBytes("iso-8859-1");
s=newString(bb);
}
catch(Exceptionee){}
returns;
}
publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException
{Connectioncon;
PreparedStatementsql;
LoginloginBean=null;
StringbackNews="";
HttpSessionsession=request.getSession(true);
try{loginBean=(Login)session.getAttribute("login");
if(loginBean==null)
{loginBean=newLogin();
session.setAttribute("login",loginBean);
}
}
catch(Exceptionee)
{loginBean=newLogin();
session.setAttribute("login",loginBean);
}
Stringlogname=request.getParameter("logname").trim(),
password=request.getParameter("password").trim();
booleanok=loginBean.getSuccess();
logname=handleString(logname);
password=handleString(password);
if(ok==true&&logname.equals(loginBean.getLogname()))
{backNews=logname+"你已经登录了";
loginBean.setBackNews(backNews);
}
else
{
booleanboo=(logname.length()>0)&&(password.length()>0);
try{con=DriverManager.getConnection("jdbc:
odbc:
4073","","");
Stringcondition="select*fromadminwherelogname=?
andpassword=?
";
sql=con.prepareStatement(condition);
if(boo)
{sql.setString(1,logname);
sql.setString(2,password);
ResultSetrs=sql.executeQuery();
booleanm=rs.next();
if(m==true)
{backNews="管理员登录成功";
loginBean.setBackNews(backNews);
loginBean.setSuccess(true);
loginBean.setLogname(logname);
}
else
{backNews="您登陆的管理员不存在,或密码不对";
loginBean.setBackNews(backNews);
loginBean.setSuccess(false);
loginBean.setLogname(logname);
loginBean.setPassword(password);
}
}
else
{backNews="您输入的管理员不存在,或密码不对";
loginBean.setBackNews(backNews);
loginBean.setSuccess(false);
loginBean.setLogname(logname);
loginBean.setPassword(password);
}
con.close();
}
catch(SQLExceptionexp)
{backNews=""+exp;
loginBean.setBackNews(backNews);
loginBean.setSuccess(false);
}
}
RequestDispatcherdispatcher=request.getRequestDispatcher("showAdminMess.jsp");
dispatcher.forward(request,response);
}
publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException
{doPost(request,response);
}
}
HandleLogin.java
packagemyservlet.control;
importmybean.data.*;
importjava.sql.*;
importjava.io.*;
importjavax.servlet.*;
importjavax.servlet.http.*;
publicclassHandleLoginextendsHttpServlet
{publicvoidinit(ServletConfigconfig)throwsServletException
{super.init(config);
try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(Exceptione){}
}
publicStringhandleString(Strings)
{try{bytebb[]=s.getBytes("iso-8859-1");
s=newString(bb);
}
catch(Exceptionee){}
returns;
}
publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException
{Connectioncon;
PreparedStatementsql;
LoginloginBean=null;
StringbackNews="";
HttpSessionsession=request.getSession(true);
try{loginBean=(Login)session.getAttribute("login");
if(loginBean==null)
{loginBean=newLogin();
session.setAttribute("login",loginBean);
}
}
catch(Exceptionee)
{loginBean=newLogin();
session.setAttribute("login",loginBean);
}
Stringlogname=request.getParameter("logname").trim(),
password=request.getParameter("password").trim();
booleanok=loginBean.getSuccess();
logname=handleString(logname);
password=handleString(password);
if(ok==true&&logname.equals(loginBean.getLogname()))
{backNews=logname+"你已经登录了";
loginBean.setBackNews(backNews);
}
else
{
booleanboo=(logname.length()>0)&&(password.length()>0);
try{con=DriverManager.getConnection("jdbc:
odbc:
4073","","");
Stringcondition="select*fromuserwherelogname=?
andpassword=?
";
sql=con.prepareStatement(condition);
if(boo)
{sql.setString(1,logname);
sql.setString(2,password);
ResultSetrs=sql.executeQuery();
booleanm=rs.next();
if(m==true)
{backNews="会员登录成功";
loginBean.setBackNews(backNews);
loginBean.setSuccess(true);
loginBean.setLogname(logname);
}
else
{backNews="您输入的会员不存在,或密码不对";
loginBean.setBackNews(backNews);
loginBean.setSuccess(false);
loginBean.setLogname(logname);
loginBean.setPassword(password);
}
}
else
{backNews="您输入的会员不存在,或密码不对";
loginBean.setBackNews(backNews);
loginBean.setSuccess(false);
loginBean.setLogname(logname);
loginBean.setPassword(password);
}
con.close();
}
catch(SQLExceptionexp)
{backNews=""+exp;
loginBean.setBackNews(backNews);
loginBean.setSuccess(false);
}
}
RequestDispatcherdispatcher=request.getRequestDispatcher("showLoginMess.jsp");
dispatcher.forward(request,response);
}
publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException
{doPost(request,response);
}
}
HandleMessage.java
packagemyservlet.control;
importmybean.data.*;
importjava.util.Date;
importjava.text.SimpleDateFormat;
importjava.sql.*;
importjava.io.*;
importjavax.servlet.*;
importjavax.servlet.http.*;
publicc
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Web 课程设计 报告书