设计 任务书 论文 开题 答辩 说明书 格式 模板 外文 翻译 范文 资料 作品 文献 课程 实习 指导 调研 下载 网络教育 计算机 网站 网页 小程序 商城 购物 订餐 电影 安卓 Android Html Html5 SSM SSH Python 爬虫 大数据 管理系统 图书 校园网 考试 选题 网络安全 推荐系统 机械 模具 夹具 自动化 数控 车床 汽车 故障 诊断 电机 建模 机械手 去壳机 千斤顶 变速器 减速器 图纸 电气 变电站 电子 Stm32 单片机 物联网 监控 密码锁 Plc 组态 控制 智能 Matlab 土木 建筑 结构 框架 教学楼 住宅楼 造价 施工 办公楼 给水 排水 桥梁 刚构桥 水利 重力坝 水库 采矿 环境 化工 固废 工厂 视觉传达 室内设计 产品设计 电子商务 物流 盈利 案例 分析 评估 报告 营销 报销 会计
 首 页 机械毕业设计 电子电气毕业设计 计算机毕业设计 土木工程毕业设计 视觉传达毕业设计 理工毕业论文 文科毕业论文 毕业设计资料 毕业设计论文流程 
垫片
您现在所在的位置:首页 >>文科毕业论文 >> 文章内容
                 
垫片
   我们提供全套毕业设计和毕业论文服务,联系点击这里给我发消息   914298682   
Hotel Reservation System Based on the JavaServer Faces Technology
文章来源:www.biyezuopin.cc   发布者:学生毕业作品网站  
This paper describes implementation of web -based hotel reservation system whichenables users tobook hotel rooms by means of a web browser. The systemis based on JavaServer Faces technology in thepresentation layer, Spring Framework in the service layerand iBatis library for the data access layer.
I. INTRODUCTION
The Hotel Reservation System is a specific type of softwarethat supports, often by means of a web browser, wholeinfrastructure of the hotel for which the system has beendeployed. Its key features are listed below:To search and to book hotel rooms.Tonotify of every event related to a user by sending the email on a given address during the registration process.
To support definition process of each component of the hotel. The components of the hotel are: rooms,promotions, packages, discounts and se rvices.To complete the reservation process by notifying the system about the fact that the guest came to the hotel and received keys to the booked room.
II. JAVASERVER FACES
The user graphical interface is a crucial part of every computer programme with regard to its responsibility for interaction with the users. This part of application should be flexible,which means susceptible to any needed changes and without any doubts, user – friendly. Regrettably, process of developing such user interface in the main requires usually a profusion of developer's work and time, making the whole development process involved and onerous.The most apting technology to this field is JavaServer Faces (JSF). This holistic, component-based solution for longstanding problems facing software developers has a specific goal: to make web development faster and easier by masking a lot of complexities hidden behind this kind of programming.JSF technology is a server-side user interface framework for Java technology-based web applications. The main components of JSF technology are as follows:
    Two JavaServer Pages custom tags library for expressing UI components within a JSP page and for wiring components to server-side objects.The user interface created with JSF technology (represented by myUI on the Fig. 1) runs on the server and renders back to the client (in this case the browser).Because web-based applications, must often appease multiple clients (such as desktop browsers, cell phones, and PDAs),JSF has a powerful architecture for displaying components in different ways. As for the browsers, for which JSF is mostly used, the default rendering technology is HTML 4.0, though the others like WML or SVG are also possible.One of the greatest advantages of JSF technology is that it offers a clean separation between behavior and presentation layers.
III. SPRING FRAMEWORK
Spring is a lightweight, inversion of control container, created to address the complexity of enterprise application development.Spring makes possible to use plain JavaBeans to achieve things that were previously only possible with EJBs [10,11].Any Java application can benefit from Spring in terms of simplicity, test-ability, and loose coupling. The Spring Framework contains a lot of features, which are well-organized in seven modules.
When taken as a whole, these modules give everything that is needed to develop enterprise applications, although there is no must to build the application fully on the Spring framework. One can pick and choose only those modules that suit best to the application and ignore the rest. This strategy was chosen for the Hotel Reservation System Since one of the core value propositions of the framework is that of enabling choice by not forcing one to apply any particular architecture, technology or methodology, Spring also provides convenient mechanisms for integration with number of third -party frameworks (also with JSF and iBatis).
IV. APACHE IBATIS DATAMAPPER
Apache iBatis JDBC – based Data Mapper provides simple and flexible way to transport data between relational database and Java, .Net or Ruby application. Contrary to popular Hibernate library, iBatis does not directly tie classes to tables or fields to columns, but instead, it couples objects with results of stored procedures or SQL statements using simple XML descriptor letting the developer to reach only for required data. The iBatis framework can map nearly any database to any object model and is very tolerant of legacy designs, or even bad designs.Simplicity is the main advantage of the iBatis over other frameworks.
The Hotel Reservation System was primarily built upon JSF technology for the user interface along with auxiliary libraries –Spring and iBatis. The application architecture is presented in Fig. 3.The composition of the system is modular. Each layer is separated with and appropriate interface layer. Such solution makes the architecture not only more error -resistant but also more flexible for changes. The presentation layer consists of the graphical user interface written in the JSF technology andunderlying backing beans objects. It communicates with the Service layer through the service interfaces.Service layer is the central business part of the system where, on the basis of the user input data, proper decisions are made. It also translates input data into explicit form understood for the Data access layer, with which communication takes place by means of Data access interface layer.The Data access layer cooperates with Data Mapper layer and is responsible for data exchange with database.The Data Mapper layer talks via JDBC to database to ask required data. This is a layer where iBatis Data Mapper plays the main role.
V. JSF - SPRING INTEGRATION
In a nutshell, JSF – Spring integration makes Spring managed beans visible as variables to JSF, just as if the Spring beans are configured as JSF managed beans.Before diving into the integration specifics of JavaServer Faces,the general integration step for any web framework must be set forth.All that need to be done, is to declare ContextLoaderListener in the standard JEE servlet web.xml deployment descriptor. This listener initializes the Spring's WebApplicationContext that contains all of the business beans in the application. (Fig. 4).The second step in the integration between Spring and JSF is specific just for JSF. The key class used in this process isDelegatingVariableResolver. To configure this variable the faces-context.xml file must be edited. After opening <faces -config> tag <application> tag must be added and within it the <variable-resolver> pointing to the Spring's DelegatingVariable Resolver must be put. The example faces -config.xml file is presented in. The DelegatingVariableResolver delegates value lookups to the default resolver of the underlying JSF implementation, and then to Spring's business context WebApplicationContext. This allows to easily inject dependencies into one's JSF-managed beans.
Example of faces-config.xml file from Hotel Reservation System application

VI. JSF AND GETMETHOD.

The JSF only recommended method for sending input data from an online form to an application server is the POST method,though sometimes there is a strong need for use the GET method instead. In the Hotel Reservati on System the GET method is used during the registration process for bringing about user account activation.The common way to implement the GET method is to create a special filter which can manipulate the header or contents (or both) of a request or response.To put GET method into operation, in case of JavaServer Faces,the following algorithm must be fulfilled in the body of thefilter:
1. Get parameters from the request.
2. Create appropriate backing bean object accordingly to the
view that will be used further.
3. Store the backing bean object in the current session.
4. Set changed JSF context as current.
5. Create view and store it in the JSF context.
6. Execute backing beans methods.
The Hotel Reservation System was also based on the Spring library, hence some changes to the raw algorithm were necessary.The foremost method for any filter is doFilter() where the proper filtration happens .
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)throws IOException,
ServletException {
FacesContext facesContext =
getFacesContext(request, response);
if (facesContext != null){
request.getRequestDispatcher(
facesContext.getViewRoot().getViewId()).
forward(request, response);
}else{
chain.doFilter(request, response);
}
}
The doFilter method from GET filter implementation As it may be seen on Fig. 6, an additional function implementing the presented algorithm was used to keep the source code clear and easy-to-read.Create appropriate backing bean object.Almost all backing beans from Hotel Reservation System have at least one property of Spring managed -bean origin. Because of that, it is necessary to set this property after backing bean object creation.
WebApplicationContext wac =WebApplicationContextUtils.
getRequiredWebApplicationContext
(servletContext);
RegisterService registerService =
(RegisterService)
wac.getBean("registerService");
ConfirmBean confirmBean = new ConfirmBean();
confirmBean.
setRegisterService(registerService);
Creating backing bean object and setting spring –origin property.Getting Spring managed -bean object requires operating on Spring's WebApplicationContext object that is initialised during the server start-up.Set changed JSFes context as current.When storing backing bean object in the session the whole Faces context becomes changed, therefore it must be set as current in order all modifications take place .
FacesContextFactory contextFactory =(FacesContextFactory)
FactoryFinder.getFactory(
FactoryFinder.FACES_CONTEXT_FACTORY);
LifecycleFactory lifecycleFactory =(LifecycleFactory)FactoryFinder.
getFactory(FactoryFinder.
LIFECYCLE_FACTORY);
Lifecycle lifecycle =lifecycleFactory.
getLifecycle(LifecycleFactory.
DEFAULT_LIFECYCLE);
facesContext = contextFactory.
getFacesContext (servletContext, req,res, lifecycle);
ProtectedFacesContext.
setFacesContextAsCurrentInstance
(facesContext);
Setting JSF context as current Before the actual setting context into current, it is indispensable to grab Lifecycle object. Lifecycle manages the processing of the entire lifecycle of a particular JSF request. It is responsible for executing all of the phases that have been defined by the JSF specification, in the specified order, unless otherwise directed by activities that occurred during the execution of each phase. An instance of Lifecycle is created by calling the getLifecycle() method of LifecycleFactory, for a specified lifecycle identifier. Because this instance is shared across multiple simultaneous requests, it must be implemented in a thread -safe manner. Using the current Lifecycle object along with ServletContext,HttpServletReqest and HttpServletResponse objects the FacesContext can be updated and becomes up to date.
Create view and store it in the JSF context.After making Faces context actual, the new view is supposed to be created and added to this context, nevertheless it is n ot possible to do it with usage of 'new' operator, instead it has to be done in an indirect manner.
UIViewRoot view = facesContext.
getApplication().
getViewHandler().
createView(facesContext,
"/confirm/register.jsp" );
facesContext.setViewRoot(view);
Creating new view and stroing it in Faces context The createView() method of ViewHandler object constructs and return a new UIViewRoot instance initialized with information from the argument FacesContext and viewId . The viewed parameter is always String variable representing (relative to /WEB-INF/ directory) path where the definition file is located.As shown in Fig. 9 the definition of the view is placed in ordinary JSP file and is located in subdirectory of a WEB-INF directory.Executing backing beans methods The last step is the actual execution of methods of the underlying, proper to created view backing bean object. This example of the filter for the GET method was based upon one used in the Hotel Reservation System, which works as a registration confirmation tool, so in the end, the method responsible for confirmation should be invoked:confirmBean.confirmRegistration(userId);
VII. CONCLUSIONS
The Hotel Reservation System is developed application designed accordingly to the modern programming trends with usage of technologies like JavaServer Faces, Spring Framework and iBatis Data Mapper. Its modular architecture makes the application more error-resistant and flexible for any changes therefore easy to add new functionality. The common problem of sending input data through the GET method has also been solved.System is easy to install and use and the three –module composition puts work-division pattern into operation.This research was supported by the Technical University of Lodz Grant K-25/1/2007/Dz.St.
  全套毕业设计论文现成成品资料请咨询点击这里给我发消息914298682      返回首页 如转载请注明来源于www.biyezuopin.cc  

                 

打印本页 | 关闭窗口
本类最新文章
Castle Bridge, W Structure in Des Feasibility Anal
PRESCRIPTIVE MET The design of Sc Introduction to
| 关于我们 | 友情链接 | 毕业设计招聘 |

Email:biyeshejiba@163.com 在线QQ: 点击这里给我发消息  914298682 学生毕业作品网站  
本站毕业设计毕业论文资料均属原创者所有,仅供学习交流之用,请勿转载并做其他非法用途.如有侵犯您的版权有损您的利益,请联系我们会立即改正或删除有关内容!
蜀ICP备10201305号-4