Home > Articles > Programming > Java

This chapter is from the book

J2EE Components

The J2EE environment is based on the concept of a software component—an abstract object that operates within some type of environment. The specific component that J2EE technology is built on is the distributed software component, a component that can be invoked remotely and can accept and receive parameters and return values.

This ability to build applications with components provides a great deal of flexibility in constructing and deploying an application and is one of the primary reasons for the interest in J2EE technology. A distributed component can be deployed on a single server and made available to multiple applications that have access to the server. The component can thus be deployed in a centralized fashion, allowing information technology (IT) management control over the operating environment of the critical business services provided by the application components.

The J2EE specification provides for different types of components that can be used to create an application. While for many the focus of a J2EE application is on the middle tiers (the presentation tier, the business tier, and the integration tier), there are J2EE components that can be used on the client tier. Most of these components are Java objects that operate within a logical container, an environment that provides a number of services for the component. The following sections identify these components.

Client Tier Components

The client tier represents the portion of the application that interacts with the user. For Web applications, this would be whatever component is running within the Web browser, potentially a simple HTML page, an HTML page with JavaScript, an HTML page running a Java applet, or a Java WebStart component.

The HTML Page

The HTML page is the most common form of interacting with the end user in a Web application. From its fairly simple, modest birth at CERN in the late 1980s, HTML and the accompanying HTTP have provided the framework for a burgeoning Web economy.

HTML is adequate for simple presentation of material but is limited in the GUI controls it can use. The basic GUI controls are available—the listbox, the radio button, the checkbox—but more sophisticated controls such as sliders and number wheels are beyond its abilities. HTML also does not allow immediate reaction to the user's actions; should a user enter a Q in a field that is designated Sex' and expects an entry of M or F, the most common approach is to allow this information to be posted back to the server, where it will be examined, and if there is an error, an error page is returned to the browser. Editing complex input pages with HTML can be a tedious experience for the user.

There are some alternatives to basic HTML. The Dynamic HTML (DHTML) standard expands upon HTML, and JavaScript provides a scripting language that most browsers support (though with a subtle variation of maddening differences). But the support for these languages varies among browser types and versions so that using them entails some risk.

The applet Component

The applet was the first Java component. The applet runs within a container provided by the browser. The container is an abstraction that provides a number of services for the applet, such as lifecycle management (starting and stopping the applet) and security (limiting the applet from accessing local resources by default).

At one time applets were considered to be the choice tool for expanding the capabilities of the Web browsers, but limitations of the GUI and the bandwidth required to download large applets led to limited usage of these components. Today many of the limitations of the GUI have been addressed (with Swing JApplet), and bandwidth is continuing to improve. Though not as commonly used as JSPs or servlets, the Java applet still represents a viable technology for applications that require a more robust interface than that of an HTML page with JavaScript.

A Java applet is effectively a class that is downloaded each time it is used. If this class uses other classes, as is common, those classes are also downloaded. As the size and complexity of the applet grows, the size of the download may also grow. A moderately complex applet could easily be 200 to 400 kilobytes in size, requiring a 2- or 3-minute download on a connection using a 56-K modem. For users used to 20-second start times for PC-based applications, running an applet of this size could appear painfully slow.

The Java applet was also designed to be secure. Since it can be downloaded over an open network, it is relatively easy for a malicious user to introduce applets that could circulate among client machines and damage them. By default, applets had restrictive security; they could not access local machine resources such as the hard disk or the printer, and they could access network resources only on the machine from which they were downloaded. While these restrictions on applets did provide solid security, they also severely limited the general usefulness of the applet (which could not send output to the printer or save a file to disk).

The initial version of the Java applet used the Java Abstract Windowing Toolkit (AWT) for the creation of the GUI, a set of widgets that was limited and paled in comparison to what was in the Microsoft Foundation Classes. The Java applet has now become the Java Swing applet, or JApplet, which provides access to a more mature set of GUI widgets. These applets, however, require the Java 2 Web server plug-in to be installed in the browser.

The Java WebStart Component

The Java WebStart component is similar to that of the applet. But unlike Java applets, the developer of the WebStart application can choose to have the application downloaded once and then stored on disk. Java WebStart can make deploying an application a much simpler process.

The Java WebStart application requires a plug-in be installed in the Web browser and can optionally install updates to all classes in the application or only to certain classes. This allows robust, client/server applications to be created and installed on a central site and then updated to client machines on an intelligent basis, updating only those classes that need to be changed. A Java WebStart application can also be run offline, without access to the server from which it was downloaded.

Java WebStart applications run in a dedicated Java runtime environment and use a default security model that is restrictive. Security involves the use of signed JAR (Java ARchive) files using digital signatures that can help insure that the code being executed by the client is the code received from the host server and not a trojan horse intruder with malicious intent. WebStart applications may or may not use this restrictive security model, and WebStart application applets may also be digitally signed, in which case they are considered "trusted" and are able to run in a less restrictive environment.

The GUI Client

The client application could also be a standalone application that uses a graphical user interface (GUI) to interact directly with the end user. Though this type of application is used less and less these days because of deployment and support issues, the GUI interface is still superior in terms of functionality of controls and performance to what can be delivered using a Web browser working with HTML and JavaScript.

Sun has aggressively improved the Swing API over the past few years and today a number of notable GUI applications including Integrated Development Environments (IDE) and OOAD modeling tools have been developed as cross-platform applications using Swing. For applications that require a more robust user interface, developing the application in Java Swing may be the preferred alternative. We demonstrate the use of the Swing GUI in Chapter 30 and 31.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020