Sunteți pe pagina 1din 5

INTRODUCTION TO WEB DEVELOPMENT II

Definition of web development

Web development is the process of developing and designing web-based multi-tier applications.

A web application is a collection of HTML/XML documents, web components (applets, servlets and
JavaServer Pages), and other resources in either a directory structure or archived format known as a web
archive (WAR) file.
A web application is located on a central server and provides service to a variety of clients.

Overview of Web Application development Process

Technologies used in Web Application Development

Servlets

A server-side Java application which can process requests from clients.

Servlets are Java programs that integrate with a web server to provide server-side processing of requests
from a client browser.
They require a web server that supports JavaServer technology, such as the Tomcat web server that ships
with JBuilder.
Java servlets can be used to replace Common Gateway Interface (CGI) programs, or used in the same
situations where you might have previously used CGI

Advantages to using servlets over CGI:


• Reduced memory overhead
• Platform independence
• Protocol independence

Advantages of Servlets over applets:


 You don’t need to worry about which JDK the client browser is running. Java doesn’t even need
to be enabled on the client browser. All the Java is executed on the server side. This gives the
server administrator more control.
 After the servlet is started, requests from client browsers simply invoke the service() method of
the running servlet. This means that clients don’t experience a performance hit while waiting for
the servlet to load. This is much faster than downloading an applet.

JavaServer Pages (JSP)

 JavaServer Pages (JSP) are an extension of servlet technology. They are essentially a simplified
way of writing servlets, with more emphasis on the presentation aspect of the application.
 The main difference between servlets and JSPs is that with servlets, the application logic is in a
Java file and is totally separate from the HTML in the presentation layer. With JSPs, Java and
HTML are combined into one file that has a .jsp extension.
 JavaServer Pages use custom tag libraries and essentially offer a simplified way to develop
servlets. They appear to be different during development, but when first run, they are compiled
into servlets by the web server.
Advantages of JSPs over servlets
 Less code to write.
 Easy to incorporate existing JavaBeans.
 Deployment is easier. More of the deployment issues are automatically taken care of for you,
because JSPs map to a web server in the same way that HTML files do.
 You can use tags only, and don’t need to embed HTML code in your JSP. This means that page
authors don’t have to know Java at all. (Of course, you can still embed HTML code in your JSP.
With careful planning, the HTML code can be cleanly separated from the Java code, making the
JSP more readable.)

disadvantages of JSPs:
 Invisible generated servlet code can be confusing, as previously mentioned.
 Since the HTML and Java are not in separate files, a Java developer and a web designer working
together on an application must be careful not to overwrite each other’s changes.
 The combined HTML and Java in one file can be hard to read, and this problem intensifies if you
don’t adhere to careful and elegant coding practices.
 The JBuilder designer does not support designing .jsp files. JSPs are very similar to ASPs
(Active Server Pages) on the Microsoft platform. The main differences between JSPs and ASPs
are that the objects being manipulated by the JSP are JavaBeans, which are platform independent.
Objects being manipulated by the ASP are COM objects,

InternetBeans Express

 JBuilder’s InternetBeans Express technology integrates with servlet and JSP technology to add
value to your application and simplify servlet and JSP development tasks.
 InternetBeans Express is a set of components and a JSP tag library for generating and responding
to the presentation layer of a web application.
 It takes static template pages, inserts dynamic content from a live data model, and presents them
to the client; then it writes any changes that are posted from the client back into the data model.
This makes it easier to create data-aware servlets and JSPs.
 A set of components and a tag library provided for easy presentation and manipulationof data
from a database. This technology is used in conjunction with servlet or JSP technology and
simplifies development of data-aware servlets or JSPs.

Struts
 An open source framework for building web applications. Struts provides a flexible control layer
based on standard technologies like Servlets, JSPs, JavaBeans, ResourceBundles, and XML.
 The Struts open source framework is based on the Model 2, or Model-View Controller, approach
to software design.
 In this framework, the model contains the data, the view is the presentation of the data, and the
controller controls the interaction between the model and the view.
-The view is typically a JSP page.
-The model can be any data access technology, from JDBC to an EJB.
-The controller is a Struts servlet called ActionServlet.
 This framework, which is a collection of classes, servlets, JSP tags, a tag library, and utility
classes, clearly divides the HTML from the Java code

Advantages of Struct
 A strut divides Java code and HTML tags.
 With Struts, your web application becomes easier to understand.
 A web designer doesn’t have to search through Java code to make changes to the presentation
 A developer doesn’t have to recompile code when redesigning the flow of the application.

JavaServer Pages Standard Tag Library (JSTL)

 A tag library which is part of the Java Web Services Development Pack 1.0 (WSDP) to provide a
set of tags that allow developers to do common tasks in a standard way. The JSTL consists of
four areas, each with its own TLD (tag library descriptor) and namespace.
 For example, instead of using different iteration tags from numerous vendors, JSTL defines a
standard tag that works the same everywhere. This standardization lets you learn a single tag and
use it on multiple JSP containers.

Cocoon

A servlet-based, Java publishing framework for XML that is integrated into JBuilder. Cocoon allows
separation of content, style, and logic.

Applets

 A specialized kind of Java application that can be downloaded by a client browser and run on the
client’s machine.
Advantages of Applets
1. Deployment and testing can be difficult.
2. You are relying on the client machine having Java enabled in its browser.
3. Different browsers support different versions of the JDK, and usually not the latest version.
4. The applet can be slow to start the first time, because it needs to be downloaded by the client.

Deciding which technologies to use in your web application

The following tips are used to choose which technology to use in developing a web application:
 Do you need a very complex UI? If your UI is more complex than just data entry components
(such as text fields, radio buttons, combo boxes or list boxes, submit buttons, etc.) and images,
you may want to use an applet.
 If you want to do a lot of server-side processing, you should use a servlet or JSP.
 If you want to avoid making your users download a lot of code and speed up application startup,
you should use a servlet or a JSP.
 If you want control over the version of the JDK for the application (without downloads), or you
are concerned about users who have Java disabled in their browsers, you should use a servlet or a
JSP.
 If you are looking for a replacement for CGI, with less memory overhead, you should use a
servlet or JSP.
 If you need something similar to an ASP, but you prefer it to be platform independent, you should
use a JSP.
 If you need a complex UI, but you also want some of the features of servlets or JSPs, consider
combining an applet and a servlet. You can have an applet on the browser (client) side talk to a
servlet on the server side.
 If you want to use a servlet or JSP, and you want to make it data-aware, you should use
InternetBeans Express.
 If you’re thinking of developing a tag library of standard routines, such as control structures or
date and number formatting, look at JSTL first to see if it already has the routines you need.
 If you want to separate the HTML from the Java code, use a Struts web application.

The basic web application development process


Design your application
Decide how you are going to structure your application and what technologies you will use. Decide what
the application will accomplish, and how it will look.

Configure your web server in the JBuilder IDE


You can optionally set up your web server to work in the JBuilder IDE, so you can compile, run, and
debug your application with the same web server you intend to use for deployment. You can also use
Tomcat, the web server that ships with JBuilder, for compiling, running, and debugging.

Develop your application


Create a WebApp, then write the code for the application. Whether your application is composed of
applets, servlets, JavaServer Pages or Struts classes, using JBuilder’s many tools simplifies development
tasks.

Compile your application


Compile the application in the JBuilder IDE.

Run your application


Run the application in the JBuilder IDE. This gives you a working preview of the application, without the
need to deploy it first. You should do some local testing of the application at this stage.

Deploy your application


Edit the web.xml and struts-config.xml files and deploy your application to the web server. (If you use
JBuilder tools, you might not have to edit these files.) The specifics of your approach to this step depends
largely on which web server you are using.

Test your application


Test your application running on the web server. This helps you find any problems with
deployment, or with the application. You should test from a client browser on a different
machine than the web server. You may also want to try different browsers, since the application
may appear slightly different in each one.

Web applications vs. distributed applications


Both handle client/server programming
Differences between web application and distributed applications

 Web applications require a browser on the client side and a web server on the server side. For
example, applets are downloaded to multiple client platforms where they are run in a Java Virtual
Machine (JVM) provided by the browser running on the client machine. Servlets and JSPs run
inside a Java-enabled web server that supports the JSP/Servlet specifications.
 Web applications can be made available to anyone who has access to the Internet, or you can put
them behind a firewall and use them only within your company’s intranet.
 A web application can be part of a larger distributed application, which, in turn, can be part of an
enterprise,
 In general, distributed applications manage and retrieve data from legacy systems. The legacy
system may exist on numerous computers running different operating systems.
 A distributed application uses an application server
 Distributed applications do not have to be Java-based; in fact, a distributed application can
contain many different programs, regardless of what language they are written in or where they
reside.
 Distributed applications are usually confined to a network within a company. You could make
parts of your distributed application available to customers over the Internet, but then you would
be combining a distributed application with a web application.

Technologies used in a distributed application


1. Common Object Request Broker Architecture (CORBA) and
2. Remote Method Invocation (RMI):

 CORBA’s primary advantage is that clients and servers can be written in any programming
language. This is possible because objects are defined with the Interface Definition Language
(IDL) and communication between objects, clients, and servers are handled through Object
Request Brokers (ORBs).
 Remote Method Invocation (RMI) enables you to create distributed Java-to-Java applications, in
which the methods of remote Java objects can be invoked from other Java virtual machines,
possibly on different hosts

S-ar putea să vă placă și