on the Web

judgedrunkshipΔιακομιστές

17 Νοε 2013 (πριν από 3 χρόνια και 8 μήνες)

88 εμφανίσεις

Chapter 17
-

Deploying Java Applications on the Web

1

Chapter 17


Deploying Java Applications
on the Web

Chapter 17
-

Deploying Java Applications on the Web

2

Client
-
Server Model


Web applications are based on a form of
distributed processing called client
-
server
computing


Client requests an action and the server performs
it


Internet is based on client
-
server model


Web browser requests a page


Web server returns the requested page to browser

1

Chapter 17
-

Deploying Java Applications on the Web

3

Typical Client
-
Server Exchange


Client computer issues a request to the Web
server


Web server gathers necessary data, carries out
the logic to fulfill the request, and returns the
results to the client


Web applications is commonly handled with Java
applets or HTML (Hyper text Markup Language)

1

17

Chapter 17
-

Deploying Java Applications on the Web

4

Typical Client
-
Server Exchange

Chapter 17
-

Deploying Java Applications on the Web

5

Creating the User Interface


Deciding on whether to use HTML or applets
requires careful consideration


Applets may require resources the client doesn’t
have


Applets can’t read/write files on the client


Applets take time to download


Thin client applications are those that minimize
processing requirements on the client


HTML is used to create thin
-
client applications

1

Chapter 17
-

Deploying Java Applications on the Web

6

Using HTML to Create an Input Form


Action attribute of the <form> tag specified
the Uniform Resource Locater (URL) of the
file on the web server


HTTP (Hypertext Transfer Protocol)
specifies transfer mechanisms


8080 specifies the communications port


Client and server listen for request on this port

1

Chapter 17
-

Deploying Java Applications on the Web

7

Java Servlets


Server
-
side applets


Java programs residing on a web server that can
be run by a web server, like Apache Tomcat


Why Servlets?


Persistent

maintain services for multiple clients


Fast

Loaded only once


Platform
-
independent

in Java


Extensible

EJBs


Secure
run through a web server


Methods:
doPost()

and
doGet()


1

Chapter 17
-

Deploying Java Applications on the Web

8

Chapter 17
-

Deploying Java Applications on the Web

9

Using JavaScript to Validate Input


JavaScript is used
to validate form data
on the client


Uses the
<script></script>
tags


If an error occurs an
alert message is
displayed


1

17

Chapter 17
-

Deploying Java Applications on the Web

10

Java Server Pages


Java Server Pages (JSP) is an HTML file
embedded with Java code


JSPs can do anything a servlet can do


All JSP files have a .jsp extension


JSP tags are enclosed in <% %>


Used to enclose executable Java statements


1

Chapter 17
-

Deploying Java Applications on the Web

11

Exploring Other Technologies


Active Server Pages (ASP)


PHP


Dynamic HTML (DHTML)


Extensible Markup Language (XML)


XHTML (Extensible HTML)


Flash


Perl and CGI


1

Chapter 17
-

Deploying Java Applications on the Web

12

Demo