图片 2

Part II 3.从Web应用开始(Getting Started with Web Applications)


Certain aspects of web application behavior can be configured when the
application is installed, or **deployed**, to the web container. The
configuration information can be specified using Java EE annotations or
can be maintained in a text file in XML format called a web application
deployment descriptor (DD). A web application DD must conform to the
schema described in the Java Servlet specification.



object. The web server converts this object to an HTTP response and
returns it to the client.


JavaServer Pages (JSP) is a technology for developing web pages that
support dynamic content which helps developers insert java code in HTML
pages by making use of special JSP tags, most of which start with <%
and end with %>. A JavaServer Pages component is a type of Java
servlet that is designed to fulfill the role of a user interface for a
Java web application. Web developers write JSPs as text files that
combine HTML or XHTML code, XML elements, and embedded JSP actions and
commands. Using JSP, you can collect input from users through web page
forms, present records from a database or another source, and create web
pages dynamically.

Main features:

  • Performance is significantly better because JSP allows embedding
    Dynamic Elements in HTML Pages itself instead of having a separate
    CGI files.
  • JSP are always compiled before it’s processed by the server unlike
    CGI/Perl which requires the server to load an interpreter and the
    target script each time the page is requested.
  • JavaServer Pages are built on top of the Java Servlets API, so like
    Servlets, JSP also has access to all the powerful Enterprise Java
    APIs, including JDBC, JNDI, EJB, JAXP etc.
  • JSP pages can be used in combination with servlets that handle the
    business logic, the model supported by Java servlet template


EE 注脚来钦定,恐怕被保养在七个被誉为Web应用程序陈设描述(Deployment
Servlet Specification中描述的形式。



图片 1


Javascript is a dynamic computer programming language. It is lightweight
and most commonly used as a part of web pages, whose implementations
allow client-side script to interact with the user and make dynamic
pages. It is an interpreted programming language with object-oriented

Main features:

  • JavaScript is a lightweight, interpreted programming language.
  • Designed for creating network-centric applications.
  • Complementary to and integrated with Java.
  • Complementary to and integrated with HTML.
  • Open and cross-platform

JavaServer PagesTM: A Developer’s Perspective

Servlets are Java programming language classes that dynamically process
requests and construct responses. Java technologies, such as JavaServer
Faces and Facelets, are used for building interactive web applications.
(Frameworks can also be used for this purpose.) Although servlets and
Java Server Faces and Facelets pages can be used to accomplish similar
things, each has its own strengths. Servlets are best suited for
service-oriented applications (web service endpoints can be implemented
as servlets) and the control functions of a presentation-oriented
application, such as dispatching requests and handling nontextual data.
Java Server Faces and Facelets pages are more appropriate for generating
text-based markup, such as XHTML, and are generally used for
presentation–oriented applications.


Java Servlets are programs that run on a Web or Application server and
act as a middle layer between a request coming from a Web browser or
other HTTP client and databases or applications on the HTTP server.
Using Servlets, you can collect input from users through web page forms,
present records from a database or another source, and create web pages

Main features:

  • Servlets execute within the address space of a Web server. It is not
    necessary to create a separate process to handle each client
  • Servlets are platform-independent because they are written in Java.
  • Java security manager on the server enforces a set of restrictions
    to protect the resources on a server machine. So servlets are
  • The full functionality of the Java class libraries is available to a
    servlet. It can communicate with applets, databases, or other
    software via the sockets and RMI mechanisms that you have seen


Web components are supported by the services of a runtime platform
called a **web container**. A web container provides such services
as request dispatching, security, concurrency, and lifecycle management.
A web container also gives web components access to such APIs as naming,
transactions, and email.

Servlets and JavaServer Pages (JSP) 1.0: A Tutorial

This chapter gives a brief overview of the activities involved in
developing web applications. First, it summarizes the web application
lifecycle and explains how to package and deploy very simple web
applications on the GlassFish Server. The chapter moves on to
configuring web applications and discusses how to specify the most
commonly used configuration parameters.




or can pass the request to another web component. A web component
eventually generates a HTTPServletResponse

Server Faces 和 Facelet


Figure 3-1 Java Web Application Request Handling

Web Applications

In the Java EE platform, **web components** provide the dynamic
extension capabilities for a web server. Web components can be Java
servlets, web pages implemented with JavaServer Faces technology, web
service endpoints, or JSP
pages. [Figure 3-1](
the interaction between a web client and a web application that uses a
servlet. The client sends an HTTP request to the web server. A web
server that implements Java Servlet and JavaServer Pages technology
converts the request into an HTTPServletRequest

object. This object is delivered to a web component, which can interact
with JavaBeans components or a database to generate dynamic content. The
web component can then generate an HTTPServletResponse

图片 2

图3-1 Java Web服务器哀告处理


电子邮件地址不会被公开。 必填项已用*标注