资源描述
资料内容仅供您学习参考,如有不当或者侵权,请联系改正或者删除。
存档编号
基于JAVAEE的航空订票系统的设计与实现
教学学院 数学与计算机科学学院
届 别
专 业
学 号
姓 名
指导教师
完成日期 5月6日
目录
内容摘要 4
关键字 4
Abstract 4
Keywords 5
1前言 6
1.1背景 6
1.2航空订票系统的特点 7
2系统分析 8
2.1可行性分析 8
2.2需求分析 9
2.3软件需求 9
3概要分析 11
3.1总体功能分析 11
3.2系统功能结构图 12
3.3数据库设计 15
4详细设计 17
4.1前台设计 17
4.2会员模块 19
4.3管理员模块 32
5系统测试 39
6总结 42
参考文献 43
内容摘要: 随着经济的快速发展,基于互联网上的交易需求量越来越多,网民不但能够在网上浏览网页,而且能够在网上买东西, 交易,开网店,订票等等。
航空订票系统是航空部门机票管理系统的一部分, 其作用是对所有待售机票和已售机票进行有效的管理。该系统解决了网民买票的不便, 帮网民省下好多宝贵的时间, 实现网上订票的简单方便。
本系统使用JSP进行网页界面的设计, 使用JSP+Servlet设计模式, 具有快速、 设计灵活、 生成的软件界面友好美观等特点。数据库使用MYSQL, 具有较高的完整性, 一致性和安全性。
关键字:航空订票 JSP+Servlet Java EE
Abstract: With the rapid development of economy, more and more Internet transactions demand based on the Internet, not only can browse webpage on the Internet, but also can buy things, in online transactions, online booking, etc..
Air booking system is a part of the ticket management system for the aviation sector, its role is to carry on the effective management of sale of all tickets sold tickets and. The system solves the inconvenience of Internet users buy, help users save a lot of valuable time, the realization is simple and convenient online booking.
The design of this system use JSP webpage interface, using the JSP+Servlet design pattern, with a friendly software interface appearance characteristics such as fast, flexible design, production. The use of MYSQL database, have high integrity, consistency and safety.
Keywords: Air Booking JSP+Servlet Java EE
1前言
1.1背景
21世纪是一个以信息化、 数字化和网络化为特征的新时代。信息技术的飞速发展不但使航空售票工作人员逐渐摆脱了繁重的手工作业、 提高了工作效率, 而且推动了航空事业的发展。随着经济的发展, 人们的生活节奏快、 时间很宝贵、 售票厅拥挤、 甚至一票难求。特别是在科技日益发达的今天, 人们对旅游出行、 春节及时回家等更加重视。因此航空订票的方便、 简洁就变得尤为重要。
利用不断成熟的互联网, 航空订票系统给人民群众提供极大的方便。普通民众只要家里接入互联网, 哪怕足不出户, 就能够快速、 方便的买到飞机票。
当前同样有较多的航空订票系统, 但它们大部分是利用C/S结构。C/S结构有三个缺点:
(1) 需要安装客户端软件;
(2) 受操作系统限制, 跨平台性差;
(3) 高昂的维护成本且投资大。
1.2航空订票系统的特点
( 1) 本系统采用B/S模式进行设计和开发, 用JavaBean+
Servlet模式进行设计和编写, 使得代码效率更高、 更容易、 更方便, 而且为以后的功能添加和系统维护提供了方便;
( 2) 不会受到系统的限制, 跨平台性好;
( 3) 充分利用了越来越成熟WWW浏览器技术, 结合浏览器的多种Script语言(VBScript、 JavaScript…)和ActiveX技术, 用通用的浏览器就能够轻松地实现了原本需要复杂专用软件才能实现的强大功能, 而且节约了开发成本, 因此这是一种全新的软件系统构造技术。
2系统分析
2.1可行性分析
2.1.1操作可行性
本系统在设计、 开发过程中一直注重系统实际的操作, 人性化的设计, 相关的操作方式与用户已有习惯的各大网站的用户操作方式基本上相同。因此, 操作方式在用户组织内是实际可行的。
2.1.2技术可行性
本系统的在windows 8系统环境下, 利用myeclipse6.5进行项目的建设和代码的开发。经过多年的发展和完善, MySQL这种数据库语言已经非常完善, 具有很好的兼容性和可操作性。因此使用现有的技术能够实现这个系统。
2.1.3经济可行性
一个项目的开发成本、 运行费用和收益这些经济因素直接影响了该系统是否值得去开发。本系统开发使用的是相当成熟的技术和语言, 系统的操作和维护都非常地简单和方便, 这些都表明了该系统是一个低成本的系统。由于该系统的运行费用很低, 因此在运营中的成本波动不大。在后期的运营中, 经济效益主要的来源是网站广告的投放。总体来说, 该系统具有经济上的可行性。
2.2需求分析
本系统操作简便统一友好的操作界面, 能够保证系统的易用性。
用户能够在个人主页上进行注册用户、 进行个人信息修改、 密码修改、 查看航班、 预订航班、 退票等。管理员拥有航班信息定制、 航班时间安排、 而且查看当前航班、 删除航班的权限。
2.3软件需求:
开发航空订票系统所需的软件为
(1) Java环境: JDK1.6 ;
(2) Web服务器: Tomcat 6.0;
( 3) Myeclipse 6.0 Myeclipse是一个功能强大的IDE。特别是集成于开源的Eclipse, 提高开发效率。
3概要分析
3.1总体功能分析
航空售票系统分为管理员和会员两个权限,本系统需要完成的功能主要有:
3.1.1管理员功能:
( 1) Make Flight: 能够制定航班;
( 2) Plan Flight: 安排航班的日期;
( 3) Search Flight: 查看航班起飞的日期;
3.1.2会员功能:
( 1) Member Register: 新用户注册一个会员;
( 2) Change Personal info: 对个人的基本信息进行修改;
( 3) Book Ticket: 实现机票的预订;
( 4) Search and Return Flight: 查看并退订机票。
整个系统的框架如下见图1
图1总体功能图
3.2系统功能结构图
整个软件根据系统需求分析, 可得出系统两种类型用户的业务流程图。
3.2.1前台业务流程
在会员业务流里面, 首先用户连接到主界面, 主界面有三个点击链接---会员注册、 会员登录、 管理员登录。如果老用户进入该网页, 则直接经过点击会员登录链接进入会员登录页面; 若是新用户进入本网页, 则点击会员注册链接, 进入注册页面进行注册, 注册成功即可登录; 但管理员是唯一, 因此用管理员帐号登录方可进入, 会员无法进入。会员注册, 经过输入个人基本信息资料, 即可完成注册。见图2
图2注册会员
会员登录成功后, 能够进入到会员个人主页, 主要有个人信息修改、 密码修改、 预订机票、 查看购物车等功能链接。会员点击个人信息修改链接, 能够修改个人信息; 点击密码修改, 能够修改密码; 点击预订机票, 能够对管理员安排的航班进行机票预订; 查看购物车能够查看预订信息, 并能够退票。见图3
图3个人主页
3.2.2后台业务流程
在后台中, 管理员能够进行航班信息预制, 并安排航班起飞时间, 查看航班、 删除一些过期航班。
图4管理员操作
3.3数据库设计
根据概念设计将概念模型转化为相应的数据表, 经过分析共建立了三张常见表包括:
用户表( User) 用于存放用户基本信息, 见表1
航班表( Sch) 用于存放航班信息, 见表2
订票表( Din) 用于存放会员订票信息, 见表3
表1 用户表
字段名称
字段类型
字段长度
是否为空
说明
UserName
Varchar
20
No
主键,用户
Password
Varchar
16
No
密码
Name
Varchar
10
No
真名
Sex
Varchar
10
No
性别
Tel
Varchar
16
No
电话
Email
Varchar
30
Yes
邮箱
Id
Varchar
30
Yes
身份证
表2航空表
字段名称
字段类型
字段长度
是否为空
说明
Hao
Varchar
10
No
航空号
Qifei
Varchar
20
No
起飞
Rqi
Date
Yes
日期
Mudi
Varchar
20
No
目的
Jiage
Int
5
No
价格
Piaosu
Int
11
No
票数
Times
Varchar
20
Yes
时刻
表3订票表
字段名称
字段类型
字段长度
是否为空
说明
Id
Varchar
20
No
用户名
Hao
Varchar
10
No
航空号
Qifei
Varchar
20
No
起飞
Rqi
Varchar
20
No
日期
Mudi
Varchar
20
No
目的
Jiage
Varchar
10
No
价格
Piaosu
Int
11
No
票数
Times
Varchar
20
Yes
时刻
4详细设计
4.1前台设计
下面以列表形式给出前台页面各部分的说明信息, 如下表4所示。
区域
名称
说明
对应文件
1
注册会员
进行会员信息注册
Register.jsp
2
会员登陆
用于会员登录
Userlogin.jsp
3
管理员登陆
管理员登录后台, 进行相关处理
administratorlogin.jsp
表4前台
图5 网站前台首页
代码如下:
<body onLoad="show()">
<div id="body_head1">
<object width="1110" height="172" style=" margin:100px;top:0px; padding:0px;">
<paramname="wmode" value="transparent" />
<paramname="moive" value="flashcss/66.swf"/>
<paramname="quality" value="hight" />
<embed src="flashcss/66.swf" width="1110" height="172">
</embed>//加载flash
</object>
</div>
<div id="body_head2" >
<object width="400" height="300"
style="position: absolute; right: 0px; top: 0px;">
<paramname="wmode" value="transparent" /><paramname="moive" value="flashcss/10.swf" />
<paramname="quality" value="hight"/>
<embed src="flashcss/10.swf" width="400" height="300">
</embed>
</object>
</div>
<form NAME="form1" METHOD="post" ACTION="">
<div align="center">
<span class="style2">Welcome to airline_book system</span>
</div>
<table border="1" align="center" cellpadding="1" bordercolor="#000000"bgcolor="#FFFFFF">
<tralign="center">
<td width="200">
<a href="register.jsp">Register Member</a>
</td>
<td width="200">
<a href="login.jsp">Member Login</a>
</td>
<td width="200">
<a href="administratorlogin.jsp">Administrator Login</a>
</td>
</tr>
</table>
<span><div align="center">
<table width="660" height="320"
border="1" align="center"
cellpadding="0" cellspacing="0">
<tr>
<td width="330" height="160" background="inmage/01.jpg">
<td width="330" height="160" background="inmage/02.jpg">
</td>//插入图像
</tr>
<tr>
<td width="330" height="160" background="inmage/03.jpg"></td>
<td width="330" height="160" background="inmage/04.jpg">
</td>
</tr>
</table></div></span>
4.2会员模块
会员管理模块共包括四个功能模块:
图6会员功能
当客户想在网站订票必须为本网站的会员, 如果不是本网站的会员客户能够在网站上进行注册成为网站的会员。
图7会员注册页面
代码如下
function User()//注册会员的验证
{ varf=document.form1;
if(f.Username.value==""){
alert("The name couldnot be empty");//用户名不能空
f.Username.focus();
f.Username.select();
return false;
}
if(f.Username.value.substring(0,1)==" ")
{
alert("The first of name couldnot be empty");
}
if(f.Username.value.length<8)//长度不能小于8
{
alert("You input the user length is too short");
}
if(f.Username.value.length>12)//长度不能大于12
{
alert("You input the user length is too long");
}
if(f.Password.value=="")
{
alert("The password couldnot be empty");
}
if(f.Password.value.substring(0,1)==" ")
{
alert("The first of password couldnot be empty");
}
if(isNaN(f.Password.value)!=true)
{
if(f.Password.value.length>12 || f.Password.value.length<6)
{
alert("The length of the password is incorrect");
}
else
{
alert("The password must be number");
}
if(f.Password.value.indexOf("-",0)>=0 || f.Password.value.indexOf("+",0)>=0)
{
alert("Can't appear sign like + -");
}
if(f.password2.value=="")
{
alert("The password couldnot be empty");
}
if(f.password2.value.substring(0,1)==" ")
{
alert("The first of password couldnot be empty");
if(f.password2.value!=f.Password.value)
{//验证密码是否一样
alert("Entered passwords differ !");
}
if(f.Name.value=="")
{
alert("The name couldnot be empty");
}
if(f.Name.value.substring(0,1)==" ")
{
alert("The first of name couldnot be empty");
}
if(isNaN(f.Name.value))
{
if(f.Name.value.length<2 || f.Name.value.length>14)//名字的长度在2到14之间
{
alert("You input the wrong name length");
}
}
else
{
alert("The name couldnot be number");
}
if(f.Tel.value=="")
{
alert("The telcouldnot be empty");
}
if(f.Tel.value.substring(0,1)==" ")
{
alert("the first of the telcouldnot be empty");
}
if(isNaN(f.Tel.value)!=true)
{
if(f.Tel.value.length<8 || f.Tel.value.length>14)
{
alert("The length of the tel is too short or too long");
}
else
{
alert("The tel must be number");
}
if(f.Tel.value.indexOf("-",0)>=0 || f.Tel.value.indexOf("+",0)>=0)//不能出现+-
{
alert("Donot appear sign like + —");
}
if(f.Email.value=="")
{
return true;
}
else
{
if(f.Email.value.substring(0,1)==" ")
{
alert("The first of id could be empty");
}
if(f.Email.value.indexOf("@",0)==-1)
{//一定要有@出现
alert("Email is error,Missing @");
}
if(f.Email.value.indexOf(".",0)==-1)
{//一定要有.出现
alert("Email is error,Missing");
}
if(f.Id.value.length!=18){
alert("Id of length must be 18!");
}
}
}
会员在注册页面上点击[Register Member]按钮, 系统进入会员注册登记页面, 客户必须按系统要求如实填写各项个人资料。
会员注册登记后, 便能够使用用户名和密码进行登录,当用户在登录窗口中输入用户名和密码后, 单击[Login]按钮, 系统将对输入的用户名和密码进行正确性验证, 如果密码正确, 则进入个人首页, 显示登录用户的用户名、 [Update Usernames’ info]按钮、 [change password][Book ticket][Search shopping][Exit]按钮, 否则提示登录失败。
图8会员登录页面
图9会员主页面
图10更新个人信息
代码如下
<form name="form1" method="post" action="NoparamServlet?param=1"onsubmit="return User()">
<table width="443" border="1" align="center" cellpadding="0"cellspacing="0">
<tr>
<td width="94" height="38">
<div align="center">
<p>Username:</p>
</div>
</td>
<td width="400">
<div align="center">
<input name="Username" type="text"
id="yonghu" size="20"
readonly="true" value="${user.username}"/>
</div>
<input name="Name" type="text" id="xingbin" size="20"value="${user.name}">
</div></td>
</tr> <tr>
<td height="38">
<div align="center">
Sex:</div></td><td>
<select name="Sex">
<option value="${ho}">${ho}</option>//得到性别的名称
<option value="${mo}">${mo}</option>
<input name="Tel" type="text"
id="zhengjian" size="20"
value="${user.tel}">//得到电话
<input name="Email" type="text"
id="Emil" size="20"
value="${user.email}">//得到email
<input name="Id" type="text"
id="Id" size="20"
value="${user.id}">//得到身份证
<input type="submit" name="Submit"
value="Alter">
图11修改密码
代码如下
function User()//对密码进行验证
{ varf=document.form1;
if(f.Password.value=="")
{
alert("The original password couldnot be empty");
if(f.Password.value.length>16||
f.Password.value.length<6)
{
alert("The length of original password is incorrect ");
f.Password.focus();
f.Password.select();
return false;
}
if(isNaN(f.Password.value))
{
alert("The original password must be number ");
if(f.Password1.value=="")
{
alert("The new password couldnot be empty");
}
if(f.Password1.value.length>16 || f.Password.value.length<6)
{//密码长度的限制
alert("The length of password too long or short");
}
if(isNaN(f.Password1.value))
{
alert("The new password must be number");
}
if(f.Password1.value!=f.Password2.value)
{//密码的一致性
alert("Enter password differ!");
}
}
点击[Book ticket]按钮后, 将会把该机票信息加入到会员的购物车中。其中航班信息的日期必须是当前服务器日期之后, 否则无法显示预订机票信息列表。
图12看票页面
图13订票页面
代码如下:
<c:forEachvar="sch" items="${sched}">//列出航班的信息
<tr>
<td height="32" align="center">
${sch.hao}
</td>
<tdalign="center">
${sch.qifei}
</td>
<tdalign="center">
${sch.mudi}
</td>
<tdalign="center">
${sch.rqi}
</td>
<tdalign="center">
${sch.times}
</td>
<tdalign="center">
${sch.jiage}
</td>
<tdalign="center">
${sch.piaosu}
</td><tdalign="center">
<a href="AffirmServlet?hao=${sch.hao}">Book
</td>
</tr>
</c:forEach>
如果出于某种原因客户什么都不想买, 客户能够点击[Return_ Ticket]按钮, 系统清空购物车中的所有购物项, 并跳转到预订机票页。
图14查看订票页面
<table width="593" border="1" align="center" //列出定票
<c:forEachvar="ary" items="${ary}">
<tr>
<td height="32" align="center">
${ary.hao}
</td>
<tdalign="center">
${ary.qifei}
</td>
<tdalign="center">
${ary.mudi}
</td>
<tdalign="center">
${ary.rqi}
</td>
<tdalign="center">
${ary.times}
</td>
<tdalign="center">
${ary.jiage}
</td>
<tdalign="center">
${ary.piaosu}
</td>
<tdalign="center">
<a href=RecedServlet?hao=${ary.hao}>Return_Ticket
</a>
</c:forEach>
</table>
4.3管理员模块
管理员模块共包括四大模块:
图15管理员模块
当管理员经过管理员渠道登录进去后, 会进入相应的航班定制主页。
图16管理员登录页面
代码如下
# Sample ResourceBundle properties file//管理员的账号
name=1
pass=1
<servlet>
<servlet-name>AdminServlet</servlet-name>
<servlet-class>com.servlet.AdminServlet</servlet-class>
<init-param>
<param-name>name</param-name>
<param-value>/WEB-INF/config.properties</param-value>
</init-param>
</servlet>
1.当管理员点击[Make Plan]按钮后, 进行当前航班的信息定制。
图17制定航班
代码如下
<form name="form1" method="post" action="SchedServlet"
onsubmit="return add()"><table width="400" border="1" align="center" cellpadding="1" cellspacing="1">
<td width="150" height="30" align="center">
Flight_Number
</td>
<td width="250">
<div align="center">
<select name="Hao">
<c:forEachvar="flight" items="${a}">
<option value="${flight}">${flight}</option>
</c:forEach>
<td height="30" align="center">//得到航班号
Launch
<div align="center">
<select name="Qifei">
<option value="Wuhan">Wuhan </option>
<option value="Beijing"> Beijing </option>
<option value="Shanghai">Shanghai</option>
<option value="Changsha">Changsha</option>
<option value="Shenzhen">Shenzhen</option>
<option value="Nanjing">Nanjing</option>
<option value="Fuzhou">Fuzhou</option>
<option value="Dalian">Dalian</option>
<option value="Tianjin">Tianjin</option>
<option value="Guangzhou">Guangzhou</option>
</select>
</div>
<td height="30" align="center">Destation</td><td>
<div align="center">
<select name="Mudi">
<option value="Wuhan">Wuhan</option>
<option value="Beijing">Beijing</option>
<option value="Shanghai">Shanghai</option>
<option value="Changsha">Changsha</option>
<option value="Shenzhen">Shenzhen</option>
<option value="Nanjing">Nanjing</option>
<option value="Fuzhou">Fuzhou</option>
<option value="Dalian">Dalian</option>
<option value="Tianjin">Tianjin</option>
<option value="Guangzhou">Guangzhou</option>
</select></div></td></tr><tr>
<td height="30" align="center">Journey( Hours) </td>
<td><div align="center">
<select name="Lchen">
<c:forEachvar="h" items"${b}">
<option value="${h}">${h}</option>
</c:forEach></div></td></tr><tr>
<td height="30" align="center">Price(¥)</td><td>
<div align="center">
<select name="Jiage">
<c:forEachvar="mon" items="${c}">
<option value="${mon}">${mon}</option>
</c:forEach>
</div></td></tr><tr>//如果预订的日期一定要比安排的日期要晚
<td height="30" align="center">Ticket</td><t
展开阅读全文