您好,欢迎访问三七文档
1《Web课程设计》课程设计报告书设计题目microblog信息系统专业班级xxxxx学号姓名xxxxxxxxx指导老师xxxxxxx设计日期xxxx年x月x日2前言Microblog信息系统主要是一个校园微博系统,在该系统中可以注册、登录,同时还分普通会员登录及管理员登录。通过登录后,可实现发布、查询、删除微博等各项功能。关键字:信息系统微博登录系统分析1.设计目的:1.综合应用java程序设计、WEB程序设计、数据库应用、计算机网络等知识设计和实现我校MicroBlog信息系统。2.通过上述设计和实现,加深对java程序设计、WEB程序设计、数据库应用、计算机网络相关理论的理解,锻炼综合应用所学知识分析问题和解决问题的能力。3.培养软件开发的团队协作精神。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)用户界面友好43.系统流程图:数据库设计在Microblog信息系统中,共设计3张表。本系统使用Access来创建数据表。数据库的名称为WEB.mdb,三张表分别为admin、message、user。主界面会员登录管理员登录输入密码输入密码会员注册输入信息注册成功退出微博发布浏览微博查询微博查询微博删除微博微博统计5表:admin表:message表:user系统实现代码Login.javapackagemybean.data;publicclassLogin{Stringlogname,password,backNews=;booleansuccess=false;publicvoidsetLogname(Stringname){logname=name;}6publicStringgetLogname(){returnlogname;}publicvoidsetPassword(Stringpw){password=pw;}publicStringgetPassword(){returnpassword;}publicStringgetBackNews(){returnbackNews;}publicvoidsetBackNews(Strings){backNews=s;}publicvoidsetSuccess(booleanb){success=b;}publicbooleangetSuccess(){returnsuccess;}}Message.javapackagemybean.data;publicclassMessage{Stringlogname=,message=,time=,title=,backNews;publicvoidsetLogname(Stringname){logname=name;}publicStringgetLogname(){returnlogname;}publicvoidsetTitle(Stringt){title=t;}publicStringgetTitle(){returntitle;}publicvoidsetTime(Stringt)7{time=t;}publicStringgetTime(){returntime;}publicStringgetMessage(){returnmessage;}publicvoidsetMessage(Stringm){message=m;}publicStringgetBackNews(){returnbackNews;}publicvoidsetBackNews(Strings){backNews=s;}}Register.javapackagemybean.data;publicclassRegister{Stringlogname=,password=,qq=,email=,phone=;StringbackNews;publicvoidsetLogname(Stringname){logname=name;}publicStringgetLogname(){returnlogname;}publicvoidsetQq(Stringq){qq=q;}publicStringgetQq(){returnqq;}publicvoidsetPassword(Stringpw){password=pw;}8publicStringgetPassword(){returnpassword;}publicvoidsetEmail(Stringem){email=em;}publicStringgetEmail(){returnemail;}publicvoidsetPhone(Stringph){phone=ph;}publicStringgetPhone(){returnphone;}publicStringgetBackNews(){returnbackNews;}publicvoidsetBackNews(Strings){backNews=s;}}ConditionQuery.javapackagemybean.data;importjava.sql.*;publicclassConditionQuery{Stringlogname;StringBufferqueryResultBylogname;publicConditionQuery(){queryResultBylogname=newStringBuffer();try{Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver);}catch(Exceptione){}}publicvoidsetlogname(Strings){logname=s.trim();queryResultBylogname=newStringBuffer();9}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(tableborder=1);str.append(thwidth=100+logname);str.append(thwidth=100+title);str.append(thwidth=100+message);str.append(thwidth=100+time);while(rs.next()){str.append(tr);str.append(td+rs.getString(1)+/td);str.append(td+rs.getString(2)+/td);str.append(td+rs.getString(3)+/td);str.append(td+rs.getString(4)+/td);str.append(/tr);}str.append(tableborder=1);con.close();}catch(SQLExceptione){System.out.println(e);}returnstr;}}10HandleAdmin.javapackagemyservlet.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);11password=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=?andpasswor
本文标题:Web课程设计
链接地址:https://www.777doc.com/doc-5958190 .html