Mobile Food Ordering Application
Chapter One
Preamble of the Study
With the rapid development of information technology, web application and Android application have been increasing in recent years. Compared with the desktop application, the advantages of web application for users are:
- No need to install and update
- Easily visit through browsers
The advantage of the Android application:
- Mobile application is convenient to carry
- Global partnerships and large install base
- Powerful development framework
- Open marketplace for distributing apps
Based on the advantages of both applications, I motivated myself to develop a combination project between web and Android application.
Tom Yum Thai Restaurant in Vaasa sells Chinese and Thai food. Due to the cheaper prices and delicious food, more and more people select to eat in this restaurant. Meanwhile, with the number of customers increasing, the new problem occurs. Because the space of the restaurant is limited, the restaurant can only seat a certain number of customers at the time, therefore, the full customer resource cannot be utilized.
Mobile Food Ordering Application is the key to solve this problem. Using this application, the customers need not go to the restaurant by themselves, but they can order the dishes through computers and Android mobiles anywhere.
CHAPTER TWO
TECHNOLOGY OVERVIEW
The administrator part was developed with struts2 framework, spring framework and JPA framework, while the display part of website for customers is implemented with servlet/JSP. MySql was chosen as a database for the project. The Android part was developed with the Android framework. Following the core frameworks will be generally introduced in this application.
Struts 2 Framework
“Apache Struts 2 is an elegant, extensible framework for creating enterprise-ready Java web applications.” /1/
Struts 2, the next generation product of Struts, is the new framework merged based on Struts 1 framework technology and WebWork framework technology. The core of Struts 2 is WebWork. /1/
As shown in Figure 1, it illustrates the Request Lifecycle in Struts2 applications. When the FilterDispatcher in the server receives the request sent from the user, it will determine the appropriate Action. As the same time, interceptors configured for applying the common functions, such as validation and file upload are applied to the Request. Then the action method executes the related operations and the Result renders the output. Then the request returns through the interceptor in the reverse order. Finally the control returned in the servlet container will send the output to the user browser. /2/
The Struts 2 allows us to define exception handlers and inceptors. Using the exception handler, we can define the exception-handling procedure on global and local basis. When the framework catches the exception, it will display the exception details information on the page. The inceptors configured to apply the functionalities, such as workflow, validation etc. are used to specify the “request-processing lifecycle” for an action. /2/
CHAPTER THREE
APPLICATION DESCRIPTION
There are certain requirements the proposed application must fulfil to meet the objectives of the project.
The requirements to be achieved:
In Background Management Platform:
- Administrator can add and modify food categories.
- Administrator can add, modify and query food information.
- Administrator can add, modify and query employee information.
- Administrator can manage orders produced from the web application and Android application.
In the Website Public Page and Android Application:
- Customer can view food information, such as category, name, price, image, description and so on.
- Customer can order food.
- Customer can modify food item, food amount in Shopping Cart.
- Produce food order.
The requirements that should be achieved:
- The project supports internationalization, customer can select different language environments according to their real requirements.
The requirements nice to be achieved:
- Permission Management in Background Management Platform
- Query Dish Function in Website Public Page
Functional Description
Destine Food System is divided into two parts in terms of roles, the background for the administrator, the website foreground public pages and the Android application for user. Functions corresponding to each role will be introduced in detail in the following.
CHAPTER FOUR
DATABASE AND GUI DESIGN
This chapter will describe database design and main graphical user interface design in this application.
Database Design
MySql was chosen as a database, the table structures and attributes are the same as POJO classes mentioned in Model Structure shows above. The main entity and their relations will be described in detail next.
CHAPTER FIVE
IMPLEMENTATION
The implementation of core functions is described in this chapter.
Adding Food in Background Management Platform
Adding Food is a core function in the Background Management Platform. The food information added here will be displayed on the Website Public Page and Android Application to the customer. The brief implementation code of this method is shown below.
<action name=“add_product” class=“productform” method=“add”> <interceptor-ref name=“fileUpload”>
- image formate allowed to be uploaded <param
name=“allowedTypes”>image/bmp,image/png,image/gif,image/jpeg,image/jpg</param> //image maximum size
<param name=“maximumSize”>1025956</param>
</interceptor-ref>
<interceptor-ref name=“defaultStack”/>
<result name=“message”>/WEB-INF/page/share/message.jsp</result> <result name=“input”>/WEB-INF/page/share/img_error.jsp</result>
</action>
Snippet 1. Action configuration in struts.xml
When ”add_product” action is executed, it will call “add“ method in productform class. Meanwhile, the size and image format are restricted. Once, this “add“ method runs successfully, this action will return to message.jsp page, otherwise, action will return to img_error.jsp page.
Snippet 2. The adding food method
Using this method, the food information will be inserted into MySql database.
Meanwhile, the image will be stored into the Tomcat server.
Display Food Information in Website Public Page
The food information added in the Background Management Platform needs to be displayed on the Website Public Page. This implementation code is described here.
CHAPTER SEX
TESTING
The project has been deployed on the Tomcat server. All objectives of the application were tested. The testing of the main features are described as the following testing table:
CHAPTER SEVEN
CONCLUSIONS
This project contains three parts, Background Management Platform, Website Public Page and Android Application. The Background Management Platform was implemented with Struts2, Spring and JPA framework. Website Public Page was achieved with Servlet/JSP and JavaBean. The Android framework was used in the Android Application.
This project was a typical combination between a website and an Android application. The aim of the project was to help the restaurant owner to improve the efficiency of managing, meanwhile, help the customer to purchase dishes in different platforms easily.
By now, the core function of this project has been implemented. The owner and employees in the company can manage dishes and handle dish orders and so on. On the public page, customers can view dish information and purchase dishes. Also, the customer can order dishes from the Android platform.
Developing the application made it possible to learn and practice the whole processes of agile development with S2SJ frameworks as well as Android framework.
Main Challenges in Developing:
- Struts2, Spring, JPA frameworks Integration
The Background Management Platform was achieved with Struts2 framework, Spring framework and JPA framework, the first challenge was how to integrate these three frameworks. For this task, the framework version, jar packages and configuration files needed to be considered and selected. Via checking related books and videos, the challenge was overcome.
- Android Network Programming
Because the project was a combination between a website and an Android application, the second challenge was how to transfer data between the website and the Android application. In order to overcome this challenge, the knowledge about the Android Network Programming was learned alone by means of different ways.
- Debugging
HTTP 404 and 500 errors appeared frequently during the project testing. Some errors often needed to be solved for a long time. Although the errors were a nuisance, it helped the programmers to improve their debugging ability and accumulate development experience.
Future Work:
- Internationalization
In the future, the system will support internationalization. At least, Finnish, Chinese and English language environment will be provided, customers that come from different countries can order dishes in their own language.
- Permission Management in Background Management Platform
The Permission Management will need to be developed in the future. Although the owner and the employees can log in to the Background Management Platform and make related operations, the owner should have a higher permission than the employees. It means that some operation only can be done by the owner, the employees have no privilege to do, for instance, adding an employee account, modifying employee information and marking employee leave.
- Query Dish Function in Website Foreground Public Page
On the Website Foreground Public Page, a Query Dish Function should to be provided. With the number of dishes increasing, customers can search some dish and view related information quickly by using this function.
- System Extension
Thanks to my friend’s idea, the system can be extended to a huge food-ordering platform. This platform is used to display the dishes of several restaurants, not only one. The restaurants can manage their own dish information in the Background Management Platform. And custmers can view the dish information of different restaurants and select the restaurant they like.
REFERENCES
- /1/Strut2 Framework Overview-Struts 2 Framework Overview (2014). Accessed 26.3.2014. http://struts.apache.org/development/2.x/
- /2/Strut2 Framework Architecture Overview-Struts 2 Framework Architecture (2014). Accessed 26.3.2014.
- http://www.roseindia.net/struts/struts2/struts-2-architecture.shtml
- /3/ Spring Framework Architecture Overview-Spring Framework Archiecture(2013). Accessed 26.3.2014.
- http://www.tutorialspoint.com/spring/spring_architecture.htm
- /4/ JPA Framework Overview-JPA Framework Overview (2013). Accessed 26.3.2014. http://en.wikipedia.org/wiki/Java_Persistence_API
- /5/ Wikipedia Foundation. Android (operating system). Accessed 26.3.2014.
- http://en.wikipedia.org/wiki/Android_%28operating_system%29#cite_note-googl e_code-6