信息java课程设计电话号码查询系统

400电话查询  时间:2021-03-19  阅读:()

山东建筑大学

Java课程设计报告设计题目 电话号码查询系统

学号 2010121187专业班级信计101

指导教师 王文

1、设计目的

1、通过JAVA课程设计使大家能够将学到的面向对象的设计思想运用在具体工

作和学习中加深对类和对象的理解要求学生对生活中许多具体的事物抽象

出类。

2、通过这次课程设计掌握JAVA的编程思想为后续设计编程打下基础。

3、培养实际操作能力和实践能力为以后的工作打下坚实的基础。

2、总体设计

3、详细设计homework\src\com\work为工作空间bean文件夹下的TelBean.java为Bean类operate文件夹下的TelOperate.java为服务器接收信息端可以对所获取的信息进行相应的方法调用。 Te l Sq l .j a va对数据库中的数据进行增删改查。

sql文件夹下Conn.java为对数据库提供驱动加载等操作。

addInfo.jsp为添加信息页面截图中有相应的运行图index.jsp为首页页面信息l istInfo.jsp为查询之后显示信息的页面searchInfo.jsp为查询条件选择页面

4、调试与测试

调试中部分功能的测试结果及截图

1、 电话管理功能列表

2、添加电话号码

添加成功

3、 显示所有电话号码信息

4、 按姓名查询功能及查询结果

查询结果

5、按电话号码查询功能及查询结果

查询结果

6、按部门查询

5、源程序清单和执行结果ifexists(select*fromdbo.sysobjectswhereid=object_id(N' [dbo] .[search]')andOBJECTPROPERTY(id,N' Is UserTa ble')=1)droptable[dbo] .[search]

GO

CREATETABLE[dbo] .[search] (

[name] [nvarchar](20)COLLATEChinese_PRC_CI_ASNOTNULL,

[tel] [varchar](11)COLLATEChinese_PRC_CI_ASNULL,

[dep] [nvarchar](20)COLLATEChinese_PRC_CI_ASNULL

)ON[PRIMARY]

GO

Beanpackagecom.work.bean;

publ icclassTelBean{privateStringname;privateStringtel;privateStringdep;publ icStringgetName(){returnna me;

}publ icvoidsetName(Stringname){this.name=name;

}publ icStringgetTel(){retu rntel;

}publ icvoidsetTel(Stringtel){this.tel=tel;

}publ icStringgetDep(){returndep;

}publ icvoidsetDep(Stringdep){this.dep=dep;

}

}

Operate

Teloperatepackagecom.work.operate;importjava. io. IOException;importjava. io.PrintWriter;importjava.net.URLDecoder;importjava.uti l .ArrayList;importjavax.servlet.ServletException;

importjavax.servlet.http.HttpServlet;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importcom.work.bean.TelBean;publ icclassTelOperateextendsHttpServlet{

**

*ThedoGetmethodoftheservlet.<br>

*

*Thismethodiscal ledwhenaformhasitstagvaluemethodequalstoget.

*

*@paramrequesttherequestsendbythecl ienttotheserver

*@paramresponsetheresponsesendbytheservertothecl ient

*@throwsServletExceptionifanerroroccurred

*@throwsIOExceptionifanerroroccurred

*/publ icvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException, IOException{request.setCharacterEncoding("utf-8");response.setCharacterEncoding("utf-8");

//初始化

PrintWriterpw=response.getWriter();

Stringtype=request.getParameter("type");

Stringname=request.getParameter("username");

Stringtel=request.getParameter("tel");

Stringdep=request.getParameter("dep");

TelSqltelSql=newTelSql();

//根据出入type判断操作方式if(type.equals("search")){

//根据条件查询

ArrayList<TelBean>searchList=telSql .geTelListByInfo(name,tel,dep);request.getSession().setAttribute("l istRes ult",searchList);request.getRequestDispatcher("l istInfo.jsp").forward(request,response);}elseif(type.equals("add")){

//添加if(telSql .addTel Info(name,tel,dep))pw.print("true");else

pw.print("false");

}elseif(type.equals("l ist")){

//列表

ArrayList<TelBean>displayList=telSql .geTelList();request.getSession().setAttribute("l istResult",displayList);request.getRequestDispatcher("l istInfo.jsp").forward(request,response);}elseif(type.equals("del")){

//删除指定信息telSql .delTel Info(name);

ArrayList<TelBean>displayList=telSql .geTelList();request.getSession().setAttribute("l istResult",displayList);request.getRequestDispatcher("l istInfo.jsp").forward(request,response);}

}

**

*ThedoPostmethodoftheservlet.<br>

*

*Thismethodiscal ledwhenaformhasitstagvaluemethodequalstopost.

*

*@paramrequesttherequestsendbythecl ienttotheserver

*@paramresponsetheresponsesendbytheservertothecl ient

*@throwsServletExceptionifanerroroccurred

*@throwsIOExceptionifanerroroccurred

*/publ icvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException, IOException{this.doGet(request,response);

}

}

Telsqlpackagecom.work.operate;importjava.sql .*;importjava.uti l .*;importcom.work.bean.*;importcom.work.sql .*;

1C2G5M轻量服务器48元/年,2C4G8M三年仅198元,COM域名首年1元起

腾讯云双十一活动已于今天正式开启了,多重优惠享不停,首购服务器低至0.4折,比如1C2G5M轻量应用服务器仅48元/年起,2C4G8M也仅70元/年起;个人及企业用户还可以一键领取3500-7000元满减券,用于支付新购、续费、升级等各项账单;企业用户还可以以首年1年的价格注册.COM域名。活动页面:https://cloud.tencent.com/act/double11我们分享的信息仍然以秒...

CloudCone2核KVM美国洛杉矶MC机房机房2.89美元/月,美国洛杉矶MC机房KVM虚拟架构2核1.5G内存1Gbps带宽,国外便宜美国VPS七月特价优惠

近日CloudCone发布了七月的特价便宜优惠VPS云服务器产品,KVM虚拟架构,性价比最高的为2核心1.5G内存1Gbps带宽5TB月流量,2.89美元/月,稳定性还是非常不错的,有需要国外便宜VPS云服务器的朋友可以关注一下。CloudCone怎么样?CloudCone服务器好不好?CloudCone值不值得购买?CloudCone是一家成立于2017年的美国服务器提供商,国外实力大厂,自己开...

Gcore(75折)迈阿密E5-2623v4 CPU独立服务器

部落分享过多次G-core(gcorelabs)的产品及评测信息,以VPS主机为主,距离上一次分享商家的独立服务器还在2年多前,本月初商家针对迈阿密机房限定E5-2623v4 CPU的独立服务器推出75折优惠码,活动将在9月30日到期,这里再分享下。G-core(gcorelabs)是一家总部位于卢森堡的国外主机商,主要提供基于KVM架构的VPS主机和独立服务器租用等,数据中心包括俄罗斯、美国、日...

400电话查询为你推荐
芜湖三七互娱网络科技集团股份有限公司involving网易yeahcentos6.5如何安装linux centos6.5163yeah163,126,yeah哪个更好啊,各有什么特点啊flashftp下载rmdown怎么下载支付宝注册网站在哪里注册支付宝补贴eset爱优网为什么优酷土豆等视频网站那么多人上传视频佛山海虹广东海虹药通电子商务有限公司怎么样?免费代理加盟怎么开免费的代理网店
免费域名注册 vps代购 美国主机排名 新秒杀 云网数据 80vps 淘宝双十一2018 dux howfile 双线主机 阿里校园 福建铁通 上海服务器 shopex主机 万网主机管理 starry web应用服务器 百度云空间 中国域名 杭州电信宽带 更多