Website + Content Management System - ISDP DEVELOPMENT PROJECT 2006/2007 SEM 2 - LITE REALTY PTE. LTD

moodusroundoΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 4 μέρες)

289 εμφανίσεις


ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

1


CONTENTS

Table of Contents

FOREWORD

................................
................................
................................
.........................

2

NECESSARY SOFTWARE

................................
................................
................................
......

3

Necessary
software

................................
................................
................................
..............................

3

Additional JAR files needed to run certain codes on the application include:

..........................

3

Online Manuals

................................
................................
................................
................................
.........

3

INSTALLATION GUIDE

................................
................................
................................
.........

4

SYSTEM OVE
RVIEW

................................
................................
................................
.............

5

FRONTEND TECHNOLOGY

................................
................................
................................
..

6

Frontend Structure

................................
................................
................................
................................
....

6

FRONTEND TECHNOLOGY

IN DETAIL:

................................
................................
...............

6

JSP Page

................................
................................
................................
................................
....................

7

Servlet

................................
................................
................................
................................
.........................

8

Action Handler

................................
................................
................................
................................
..........

9

Bridge

................................
................................
................................
................................
......................

10

Bridge

................................
................................
................................
................................
...................

10

Getter Bridge

................................
................................
................................
................................
......

10

Setter Bridge

................................
................................
................................
................................
.......

11

JSP TECHNOLOGIES AND

TOOLS

................................
................................
......................

12

Animated Collapse

................................
................................
................................
................................

12

Lbox

................................
................................
................................
................................
.........................

13

DisplayTag

................................
................................
................................
................................
..............

14

UploadBean

................................
................................
................................
................................
............

15

Tiny Mce

................................
................................
................................
................................
..................

16

dhtmlxTabbar

................................
................................
................................
................................
.........

17

BACKEND TECHNOLOGY

................................
................................
................................
..

18

Introduction to Hibernate

................................
................................
................................
.....................

18

Hibernate Implementation in the ISDP Project

................................
................................
.................

19

The 3 Layers within the Back
-
end Tier

................................
................................
............................

19

BACKEND TECHNOLOGY I
N DETAIL:

................................
................................
................

20

The Process Layer

................................
................................
................................
................................
..

20

The Business Logic L
ayer

................................
................................
................................
......................

21

Data Access Object Layer

................................
................................
................................
...................

22



ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

2


FOREWORD




ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

3


NECESSARY SOFTWARE

Necessary software

Below are a list of necessary that must be installed for the deployment, development and maintenance of the
LiteRealty Web Application
.


A copy of all these software’s will be made available in the program CD.

Java EE SDK:
http://java.sun.com/javaee/downloads/index.jsp

Java Runtime Environment:

http://www.java.com/en/download/manual.jsp

Netbeans IDE
5.5.1
:

http://www.netbeans.info/downloads/all.php?b_id=3095

Netbeans IDE E
nterprise Pack:

http://developers.sun.com/jsenterprise/nb_enterprise_pack/

Apache Tomcat 5.5:

http://tomcat.apache.org/downl
oad
-
55.cgi

MySQL 5.0 Community Server
:

http://dev.mysql.com/downloads/mysql/5.0.html

MySQL GUI Tools Bundle for 5.0
:

http://dev.
mysql.com/downloads/gui
-
tools/5.0.html

Includes the following software’s;



MySQL Administrator 1.2



MySQL Query Browser 1.2



MySQL Migration Toolkit 1.1

Additional JAR files needed to run certain codes on the application include:



Hibernate Core for Java

:
http://www.hibernate.org/6.html


More information here :
http://www.hibernate.org/344.html



Apache Commons
Lang
:

http://commons.apache.org/downloads/download_lang.cgi

Select Binary Download
(
.
Z
ip
)



Jasypt, Java Simplified Encryption
:
http://www.jasypt.org/download.html




Online Manuals

An online copy of the Netbeans IDE 5.5.1:
http://www.netbeans.org/community/releases/55/1/install.html




ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

4


INSTALLATION GUIDE



ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

5


SYSTEM OVERVIEW



JSP Page

Servlet

Handler

Bridge

Process
Layer

Business
Logic
Layer

Data
Access
Object
Layer

Database

ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

6


JSP

Servlet

ActionHandler

Bridge

FRONTEND TECHNOLOGY

Frontend
Structure

In this project, we adopted the 3
-
tier architecture; Presentation Layer, Business logic layer and data base
layer. Therefore in the frontend, we deal mainly with the presentation layer.

The presentation layer is suppose to have minimal data proc
essing and contains no business logic. In this layer,
it is made up of 3 different parts. They are: Java Server Pages (JSP), servlet and ActionHandler java class.

In a function such as create property, the processing sequence in
the front end is described
in the following
diagram
:









This model promotes the use of the Model View Controller (MVC) architectural style design pattern.


The JSP will send the user request to the servlet. From the servlet it will get the necessary data from JSP and
call metho
ds in Action handler which will connect to the bridge, which is a connector between the presentation
layer to the business logic layer.


The next page will describe in detail the functions within the presentation layer.



FRONTEND

TECHNOLOGY


IN DETAIL:

ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

7


JS
P Page

A JSP page is basically a web page with traditional HTML and bits of Java code. The file extension of a JSP
page is .jsp rather than .html or .htm, which tells the server that this page requires special handling that will be
accomplished by a server

extension or a plug
-
in.


When a JSP page is called, it will be compiled (by the JSP engine) into a Java servlet. At this point the servlet
is handled by the servlet engine, just like any other servlet.

The servlet engine then loads the servlet class (using a class loader) and executes it to create dynamic HTML
to be sent to the browser. The servlet creates any necessary object, and writes any object as a string to an
output stream to the browser.

Left:
Java Script code
snippet

In the JSP, we use
JavaScript to do form
validations. Only if the
JavaScript validation is
passed, then data will
be posted to the servlet
for further processing.





ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

8


Servlet

The servlet acts as a controller responsible for proces
sing requests and creating any POJO classes needed by
the JSP page. When the form is submitted to the servlet, all the data is retrieved out from the form. If there is
a need, the servlet will perform some checking before deciding whether to continue the
process by calling
methods in the action handler or throw error.

The controller is also responsible for deciding to which JSP page to forward the request. The JSP page
retrieves objects created by the servlet and extracts dynamic content for insertion with
in a template.

Servlet make calls to the Action handler and process the values or objects returned by the action handler. If
nothing goes wrong, servlet will redirect/forward the user to the correct page.

Servlet also catches any errors thrown by the busin
ess logic layer. Servlet will then take the necessary actions
and redirect user to an error page.

LEFT:

Servlet
code
snippet




ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

9


Action Handler

Action Handler is a java class that contains methods for servlet to call, which will link to the bridge and from
there, to the business logic layer.

In the action handler class, other than methods that calls the bridge methods, it also contains some meth
ods
that help the servlet to process some data.

LEFT:

Create a
POJO class
from the
servlet’s
input data.





Most methods in the methods in action handler will throw any error from the backend business logic layer to
the servlet. The Servlet
will catch t
he error and display the

error messages.

LEFT:

Action Handler code
snippet



ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

10


Bridge

Bridge is a java class that connects the front end and backend. This class acts as the linkage between the
action handler and process class. In the bridge, it consists
of methods for action handler to make backend calls
and values are returned or exceptions are thrown.


There are 3 types of bridges. Bridge, Getter Bridge and Setter Bridge

Bridge

In this class, all the
validation process
methods are placed here.







Getter Bridge

In this class, all the GET
process methods are
placed here. Each method
returns an Object or a List
of Objects.



ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

11


Setter Bridge

In this bridge,
methods here are
those that will make
changes to the
database. These
methods usually
are:
Create/
Add/Delet
e/Update/Reset




ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

12


JSP TECHNOLOGIES AND

TOOLS


In the JSPs, we include some technologies that will enhance the user’s surfing experience. These technologies
are based on JavaScript. With these tools, the overall website interface and user friendlin
ess increases.

Below is the list of technologies we adopted:

1.

Animated Collapse

2.

lbox

3.

displaytag

4.

uploadbean

5.

tiny_mce

6.

dhtmlxTabbar


Animated Collapse

This is a piece of JavaScript that allows our side menu to have
the “drop down” effect. This “drop down” effect is also used in
our form validations. When the form does not pass the
JavaScript form validation, the error will be shown.



ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

13


Lbox

This tool is
used to display image by using a piece JavaScript code. This tool allow user to browse through a
few pictures too.






ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

14


DisplayTag

Displaytag is a very useful tool when it comes to displaying a collection of data in a table. The display tag
library is an
open source suite of custom tags that provide high
-
level web presentation patterns which will
work in an MVC model. The library provides a significant amount of functionality while still being easy to use.

Display tag itself has a bunch of functionalities
which allows developer to do things like paging, sorting, file
export and many more.


LEFT:


A
Display
Tag
code
snippet



ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

15


UploadBean

UploadBean is a JAVA/JSP/Servlets upload component. UploadBean is designed to upload files from
browser.

This bean
can

be integrated in any JSP/Servlets application. The uploaded file can be stored in a Folder, a
ZIP archive, a Database or in Memory. Restrictions such as file size limit, blacklist/whitelist and max.
Uploaded files are available.

LEFT:

Uploaded
bean
code
snippet



ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

16


Tiny Mce

TinyMCE is a small WYSIWYG editor control for web browsers such as MSIE or Mozilla that enables you to
edit HTML contents in a more user friendly way. It has common features that are found in most word
processors and should not be diffic
ult to use.


This editor is used in our email management and content management which allows user to configure and
design html content.




ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

17


dhtmlxTabbar

dhtmlxTabbar is a
JavaScript tabbar control

for creating dynamic tabbed
-
navigation interface. This Aja
x
-
enabled UI component lets you add feature
-
rich and nice looking tabs.


The control can be easily initialized on a web page that makes building of DHTML tabbed interface a
breeze. Just assign any elements on the page (for example DIVs) to the tabs of Tabb
ar, and it will
automatically do all work
-

the component will switch these elements displaying them by clicking on
corresponding tab.





ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

18


BACKEND TECHNOLOGY

Introduction to Hibernate


Instead of coding regular SQL queries and Prepared
Statements, which

are regular and common in normal web
solutions, we opted to try and use an object/relational
persistence and query service called “
Hibernate
”.


As quoted by the hibernate website at
www.hibernate.org


Hibernate

is a powerful, high performance
object/relational persistence and query service.
Hibernate

lets you develop persistent classes following
object
-
oriented idiom
-

including association, inheritance, polymorphism, composition, and collections.
Hibernate

allo
ws you to express queries in its own portable SQL extension (HQL), as well as in native
SQL, or with an object
-
oriented Criteria and Example API.”


What this means is that during the development, all the tables and SQL/HQL queries are modeled directly
from

the application side of the system.

With that, we minimize the need to continuously worry if the database and the web application will work
together when both of them are developed separately. Instead, modeling it from the application side makes it
easier

to make future changes as Hibernate will take care of communication to the database and as
programmers, we will then only focus on the logic and the system itself.

Hibernate is 100% pure Java and therefore

interoperable with most operating systems that ar
e

capable of
running a Java Virtual Machine (JVM);

including Windows®, UNIX®, and Linux®.


Hibernate is also open source, developed and used by many professional companies. For more information,
please visit the above mentioned website.



ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

19


Hibernate
Implementation in the ISDP Project

The 3 Layers within the Back
-
end Tier


For this project, we have implemented Hibernate within a 3 tier framework which operates within the back
-
end of the application.





Process Layer


Is the overall method responsible for a single unit of
work


Eg. CreateHDBProperty, DeleteUserProperty.


Single Instances of methods used by the front end
developers

Business Logic Layer


Interacts with the Process Layer and the DAO Layer


Contains validation and logics modelled around
business obejcts which the frontend developers do not
see


A single layer in which should any business
requirements change, it can be done in an instant.


Possible to call different business logics in different
classes

DAO Layer

(Data Access Object)


Responsible for querying to database for needed
functions


Queries are built around Hibernates Criteria Query,
Hibernate Query Language, and Prepared
Statements


Well written SQL statements, Prepared Statements,
and Hibernates Criteria Query minimize the risk of
SQL Injection

Database


Stores the data

ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

20


BACKEND TECHNOLOGY

IN
DETAIL:

The Process Layer

The Process Class is classes which contain single user methods which are called by the frontend functions used
by the frontend developers. These methods are the only methods which provide the services needed by the
frontend developers from the backend.


R
ight
: A sample of a process class
found within the system.


Each method within the process class
will then call their respective Business
Logic (BL) Classes and Data Access
Object (DAO) Classes.


Depending on what function the
method is providing, some ma
y or
may not need to call the BL class.



ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

21


The Business Logic Layer

This class is the one that bores the core of the logic within the backend tier of the system.

Each Business Logic class contains methods which ensure the business requirements and procedur
es are checked
and validated before the Process Class continues with the rest of the method flow. Each method will return an
exception should the validations fail, breaking the flow. The error message will then traverse back to the
frontend developers codi
ng the system, and in some instances, the user using the system.


Above

is a sample from the application demonstrating validation logics and communication with the DAO
layer.



ISDP D
EVELOPMENT PROJECT 2006/2007 SEM
2
-

LITE REALTY PTE. LTD



Diploma In Information Technology
-

Singapore
Polytechnic 06/07

22


Data Access Object Layer

This class houses mostly the SQL/HQL, Criteria Query
and Prepared Statements needed to interact with the
database.

Many of the queries written were based around Hibernates Query Language (HQL), Criteria Query and some
Prepare Statements, to fully utilize the technology.

One feature of the Data Access Object
Layer implementation with Hibernate is that we have successfully
reduced the amount of handwritten SQL, instead, opting to let Hibernate automate the query for us. This has
led the search methods to become very robust and being able to be used efficiently
and be reusable for
other methods.