Advantages of Java Servlets PORTABLE

quaggahooliganInternet και Εφαρμογές Web

5 Φεβ 2013 (πριν από 4 χρόνια και 4 μήνες)

105 εμφανίσεις

Six Degrees of
Separation


Saahil Peerbhoy

Amortya Ray

Aaron Fernandes

Ritika Virmani

Swapneel Sheth

Josh Poritz

Goal


To compare and contrast different scripting
languages/frameworks by developing a basic
application that performs:



create, update, delete and insertion operations on a
database.


Basic input validation, such as SQL injection .


Searching and Sorting of the songs in the database.

Languages/Frameworks


Saahil : Java Servlets


Amortya : Python


Turbogears


Aaron : PHP


symfony


Ritika : Python


Django


Swapneel : Ruby


Ruby on Rails


Josh : Perl


Catalyst


Database Schema


Online Music Repository Database


Single table having the following schema



Songs (


SongId

int


Title

varchar


Artist

varchar


Album

varchar


Year

int



Genre

varchar


Rating

int


Length

time

)

Java Servlets Implementation


Servlets are Java technology's answer to CGI
programming



Database server : MySQL


Web Server : Jakarta Tomcat



MVC Framework


The implementation using servlets does not
follow the Model
-
View
-
Controller framework


One way to do so would have been to use JSP’s
along with servlets. Then,


Servlets
-

controller


JSPs


View


Database
-

Model

Three Tier Architecture

Advantages of Java Servlets


Efficiency :

For every request, another process is not
spawned (unlike PHP
-
CGI). Instead, the JVM spawns a
lightweight thread which deals with the particular
request.


Only one copy of the servlet class is loaded into
memory.


The servlets remain in memory between requests and
thus make it easy to store data between requests.


Example : maintaining a database connection pool.
(DBConnectionPool class)




Advantages of Java Servlets


Convenient

: Plenty of useful packages available
for you to use.


I would have to agree that writing a simple
application using servlets is easier in other
languages, but if you want to do something a
little more complex there are plenty of Java
APIs available for you to use


You already know Java.

Advantages of Java Servlets


PORTABLE

: Servlets are written in Java and
hence are highly portable. The same servlet can
be run on virtually
any

web server



SECURE

: Servlets are executed within the ‘safe’
environment of the JVM and are thus inherently
safe

Java Frameworks


Apache Struts:

is an open
-
source framework for
developing Java EE web applications. It uses and
extends the Java Servlet API to encourage developers
to adopt a model
-
view
-
controller (MVC) architecture.



Disadvantages:



1
. Big learning curve.



2
. Documentation is not as good as that for



servlets.