Understanding Java Servlets Basics
Understanding Java Servlets Basics
Invokes the CGI application within the process and passes the request information to
the application.
Collects the response from the CGI application.
2
Destroys the process, prepares the HTTP response, and sends it to the client.
Servlets can directly communicate with the CGI cannot directly communicate with the
webserver. webserver.
Servlets are less expensive than CGI. CGI is more expensive than Servlets.
Servlets can handle the cookies. CGI cannot handle the cookies.
Servlets
Servlet is faster
new request received.
Servlets, as written in Java, are platform-independent.
Removes the overhead of creating a new process
run in a separate process. There is only a single instance that handles all requests
concurrently. This also saves the memory and allows a Servlet to easily manage the
client state.
It is a server-side component, so Servlet inherits the security provided by the Web
server.
The API designed for Java Servlet automatically acquires the advantages of the Java
platforms such as platform-independent and portability. In addition, it obviously can
use the wide range of APIs created on Java platforms such as JDBC to access the
database.
Many Web servers that are suitable for personal use or low-traffic websites are offered
for free or at extremely cheap costs eg. Java servlet. However, the majority of
commercial-grade Web servers are rather expensive, with the notable exception of
Apache, which is free.
Decode and Encode MIME-based messages: Provides the service of decoding and
encoding MIME-based messages.
Manage Servlet container: Manages the lifecycle of a Servlet.
Resource management Manages the static and dynamic resources, such as HTML
files, Servlets, and JSP pages.
Security Service: Handles authorization and authentication of resource access.
Session Management: Maintains a session by appending a session ID to the URL
path.
The web container maintains the life cycle of a servlet instance. Let's see the life cycle of the servlet:
As displayed in the above diagram, there are three states of a servlet: new, ready and end. The servlet
is in new state if servlet instance is created. After invoking the init() method, Servlet comes in the
ready state. In the ready state, servlet performs all the tasks. When the web container invokes the
destroy() method, it shifts to the end state.
The classloader is responsible to load the servlet class. The servlet class is loaded when the first
request for the servlet is received by the web container.
The web container creates the instance of a servlet after loading the servlet class. The servlet instance
is created only once in the servlet life cycle.
The web container calls the service method each time when request for the servlet is received. If
servlet is not initialized, it follows the first three steps as described above then calls the service
method. If servlet is initialized, it calls the service method. Notice that servlet is initialized only once.
The syntax of the service method of the Servlet interface is given below:
The web container calls the destroy method before removing the servlet instance from the service. It
gives the servlet an opportunity to clean up any resource for example memory, thread etc. The syntax
of the destroy method of the Servlet interface is given below:
Uses of Package
6
[Link]
GenericServlet
Defines a generic, protocol-independent servlet.
Servlet
Defines methods that all servlets must implement.
ServletConfig
A servlet configuration object used by a servlet container to pass information to a servlet during
initialization.
ServletContext
Defines a set of methods that a servlet uses to communicate with its servlet container, for
example, to get the MIME type of a file, dispatch requests, or write to a log file.
ServletException
Defines a general exception a servlet can throw when it encounters difficulty.
ServletInputStream
Provides an input stream for reading binary data from a client request, including an
efficient readLine method for reading data one line at a time.
ServletRequest
Defines an object to provide client request information to a servlet.
ServletRequestWrapper
Provides a convenient implementation of the ServletRequest interface that can be subclassed by
developers wishing to adapt the request to a Servlet.
ServletResponse
Defines an object to assist a servlet in sending a response to the client.
ServletResponseWrapper
Provides a convenient implementation of the ServletResponse interface that can be subclassed by
developers wishing to adapt the response from a Servlet.
The ServletRequest interface includes methods that allow you to read the names and values of
parameters that are included in a client request. We will develop a servlet that illustrates their use.
The example contains two files. A web page is defined in [Link], and a servlet is
defined in [Link].
The HTML source code for [Link] is shown in the following listing. It defines a table
that contains two labels and two text fields. One of the labels is Employee and the other is Phone.
There is also a submit button. Notice that the action parameter of the form tag specifies a URL. The
URL identifies the servlet to process the HTTP POST request.
<html>
<body>
<center>
action="[Link]
servlet/PostParametersServlet">
<table>
<tr>
<td><B>Employee</td>
<tr>
<td><B>Phone</td>
</table>
</html>
The source code for [Link] is shown in the following listing. The service(
) method is overridden to process client requests. The getParameterNames( ) method returns an
enumeration of the parameter names. These are processed in a loop. You can see that the parameter
name and value are output to the client. The parameter value is obtained via the getParameter(
) method.
PrintWriter pw = [Link]();
[Link]();
}
Compile the servlet. Next, copy it to the appropriate directory, and update the [Link] file, as
previously described. Then, perform these steps to test this example:
After following these steps, the browser will display a response that is dynamically generated by the
servlet.
The [Link] Package
The preceding examples have used the classes and interfaces defined in [Link], such
as ServletRequest, ServletResponse, and GenericServlet, to illustrate the basic functionality of
servlets. However, when working with HTTP, you will normally use the interfaces and classes
in [Link]. As you will see, its functionality makes it easy to build servlets that work with
HTTP requests and responses.
Interface : Description
Class : Description
The HttpServletRequest interface enables a servlet to obtain information about a client request.
Several of its methods are shown in Table 38-5.
request succeeded, and SC_NOT_FOUND indicates that the requested resource is not available.
Several methods of this interface are summarized in Table 38-6.
The HttpSession Interface
The HttpSession interface enables a servlet to read and write the state information that is associated
with an HTTP session. Several of its methods are summarized in Table 38-7. All of these methods
throw an IllegalStateException if the session has already been invalidated.
12
The Cookie class encapsulates a cookie. A cookie is stored on a client and contains state information.
Cookies are valuable for tracking user activities. For example, assume that a user visits an online
store
enter this data each time he or she visits the store.
addCookie( ) method of
the HttpServletResponse interface. The data for that cookie is then included in the header of the
HTTP response that is sent to the browser.
expiration
date is not explicitly assigned to a cookie, it is deleted when the current browser session ends.
The domain and path of the cookie determine when it is included in the header of an HTTP request.
If the user enters a URL whose domain and path match these values, the cookie is then supplied to
the web server. Otherwise, it is not.
There is one constructor for Cookie. It has the signature shown here: Cookie(String name,
String value)
Here, the name and value of the cookie are supplied as arguments to the constructor. The methods of
the Cookie class are summarized in Table 38-8.
The HttpServlet class extends GenericServlet. It is commonly used when developing servlets that
receive and process HTTP requests. The methods defined by the HttpServlet class are summarized
in Table 38-9.
Method : Description
boolean getSecure( ) : Returns true if the cookie is secure. Otherwise, returns false.
boolean isHttpOnly(?) : Returns true if the cookie has the HttpOnly attribute.
The HttpServlet class provides specialized methods that handle the various types of HTTP
requests. A servlet developer typically overrides one of these methods. These methods
are doDelete( ), doGet( ), doHead( ), doOptions( ), doPost( ), doPut( ), and doTrace( ).
A complete description of the different types of HTTP requests is beyond the scope of this book.
However, the GET and POST requests are commonly used when handling form input. Therefore,
this section presents examples of these cases.
16
Here we will develop a servlet that handles an HTTP GET request. The servlet is invoked when a
form on a web page is submitted. The example contains two files. A web page is defined
in [Link], and a servlet is defined in [Link]. The HTML source code
for [Link] is shown in the following listing. It defines a form that contains a select element
and a submit button. Notice that the action parameter of the form tag specifies a URL. The URL
identifies a servlet to process the HTTP GET request.
<html>
<body>
<center>
<form
name="Form1" action="[Link]
<B>Color:</B>
<select name="color" size="1"> <option value="Red">Red</option> <option
value="Green">Green</option>
<option value="Blue">Blue</option> </select>
<br><br>
<input type=submit value="Submit"> </form>
</body>
</html>
The source code for [Link] is shown in the following listing. The doGet( ) method
is overridden to process any HTTP GET requests that are sent to this servlet. It uses
the getParameter( ) method of HttpServletRequest to obtain the selection that was made by the
user. A response is then formulated.
import [Link].*; import [Link].*;
import [Link].*;
public class ColorGetServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String color = [Link]("color"); [Link]("text/html"); PrintWriter pw
= [Link](); [Link]("<B>The selected color is: "); [Link](color);
[Link]();
}
}
17
Compile the servlet. Next, copy it to the appropriate directory, and update the [Link] file, as
previously described. Then, perform these steps to test this example:
Select a color.
After completing these steps, the browser will display the response that is dynamically generated by
the servlet.
One other point: Parameters for an HTTP GET request are included as part of the URL that is sent to
the web server. Assume that the user selects the red option and submits the form. The URL sent from
the browser to the server is
[Link]
The characters to the right of the question mark are known as the query string.
Here we will develop a servlet that handles an HTTP POST request. The servlet is invoked when a
form on a web page is submitted. The example contains two files. A web page is defined
in [Link], and a servlet is defined in [Link].
The HTML source code for [Link] is shown in the following listing. It is identical
to [Link] except that the method parameter for the form tag explicitly specifies that the
POST method should be used, and the action parameter for the form tag specifies a different servlet.
<html>
<body>
<center>
action="[Link]
<B>Color:</B>
18
</body>
</html>
The source code for [Link] is shown in the following listing. The doPost( ) method
is overridden to process any HTTP POST requests that are sent to this servlet. It uses
the getParameter( ) method of HttpServletRequest to obtain the selection that was made by the
user. A response is then formulated.
[Link]();
}
Compile the servlet and perform the same steps as described in the previous section to test it.
Using Cookies
on a web page is submitted. The example contains three files as summarized here:
File : Description
[Link] : Allows a user to specify a value for the cookie named MyCookie.
[Link] : Processes the submission of [Link].
[Link] : Displays cookie values.
The HTML source code for [Link] is shown in the following listing. This page contains a
text field in which a value can be entered. There is also a submit button on the page. When this button
is pressed, the value in the text field is sent to AddCookieServlet via an HTTP POST request.
19
<html>
<body>
<center>
</form>
</body>
</html>;
The source code for [Link] is shown in the following listing. It gets the value of
the parameter named "data". It then creates a Cookie object that has the name "MyCookie" and
contains the value of the "data" parameter. The cookie is then added to the header of the HTTP
response via the addCookie( ) method. A feedback message is then written to the browser.
import [Link].*; import [Link].*;
import [Link].*;
public class AddCookieServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// Get parameter from HTTP request.
String data = [Link]("data");
// Create cookie.
Cookie cookie = new Cookie("MyCookie", data);
Add cookie to HTTP response. [Link](cookie);
Write output to browser. [Link]("text/html"); PrintWriter pw =
[Link](); [Link]("<B>MyCookie has been set to"); [Link](data);
[Link]();
}
}
The source code for [Link] is shown in the following listing. It invokes
the getCookies( ) method to read any cookies that are included in the HTTP GET request. The names
and values of these cookies are then written to the HTTP response. Observe that the getName(
) and getValue( ) methods are called to obtain this information.
import [Link].*; import [Link].*;
import [Link].*;
20
After completing these steps, you will observe that a feedback message is displayed by the browser.
Next, request the following URL via the browser:
[Link]
Observe that the name and value of the cookie are displayed in the browser.
In this example, an expiration date is not explicitly assigned to the cookie via the setMaxAge(
) method of Cookie. Therefore, the cookie expires when the browser session ends. You can
experiment by using setMaxAge( ) and observe that the cookie is then saved on the client machine.
Session Tracking
HTTP is a stateless protocol. Each request is independent of the previous one. However, in some
applications, it is necessary to save state information so that information can be collected from several
interactions between a browser and a server. Sessions provide such a mechanism.
A session can be created via the getSession( ) method of HttpServletRequest.
An HttpSession object is returned. This object can store a set of bindings that associate names with
21
JSP(JavaServer Pages)
22
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.
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.
Advantages of JSP:
vs. Pure Servlets: It is more convenient to write (and to modify!) regular HTML than to have
plenty of println statements that generate the HTML.
JSP Processing:
The following steps explain how the web server creates the web page using JSP:
As with a normal page, your browser sends an HTTP request to the web server.
The web server recognizes that the HTTP request is for a JSP page and forwards it to a
JSP engine. This is done by using the URL or JSP page which ends with .jsp instead of
.html.
The JSP engine loads the JSP page from disk and converts it into a servlet content. This
conversion is very simple in which all template text is converted to println( ) statements
and all JSP elements are converted to Java code that implements the corresponding
dynamic behavior of the page.
The JSP engine compiles the servlet into an executable class and forwards the original
request to a servlet engine.
A part of the web server called the servlet engine loads the Servlet class and executes
it. During execution, the servlet produces an output in HTML format, which the servlet
engine passes to the web server inside an HTTP response.
The web server forwards the HTTP response to your browser in terms of static HTML
content.
Finally web browser handles the dynamically generated HTML page inside the HTTP
response exactly as if it were a static page.
23
LIFE CYCLE:
A JSP life cycle can be defined as the entire process from its creation till the destruction which is
similar to a servlet life cycle with an additional step which is required to compile a JSP into servlet.
Compilation
Initialization
Execution
Cleanup
24
JSP Compilation:
When a browser asks for a JSP, the JSP engine first checks to see whether it needs to compile the
page. If the page has never been compiled, or if the JSP has been modified since it was last
compiled, the JSP engine compiles the page.
JSP Initialization:
When a container loads a JSP it invokes the jspInit() method before servicing any requests. If you
need to perform JSP-specific initialization, override the jspInit() method:
Typically initialization is performed only once and as with the servlet init method, you generally
initialize database connections, open files, and create lookup tables in the jspInit method.
JSP Execution:
This phase of the JSP life cycle represents all interactions with requests until the JSP is
destroyed.
Whenever a browser requests a JSP and the page has been loaded and initialized, the JSP engine
invokes the _jspService() method in the JSP.
The _jspService() method of a JSP is invoked once per a request and is responsible for generating
the response for that request and this method is also responsible for generating responses to all
seven of the HTTP methods ie. GET, POST, DELETE etc.
JSP Cleanup:
The destruction phase of the JSP life cycle represents when a JSP is being removed from use by a
container.
The jspDestroy() method is the JSP equivalent of the destroy method for servlets. Override
jspDestroy when you need to perform any cleanup, such as releasing database connections or
closing open files.
JSP Elements :
1. JSP Comments
2. JSP Scriptlets
3. JSP Expression
4. JSP Directives
5. JSP Declaration
1. JSP Comments
Since JSP is built on top of HTML, we can write comments in JSP file like html
comments as
These comments are sent to the client and we can look it with view source option
of browsers.
This comment is suitable for developers to provide code level comments because
these are not sent in the client response.
2. JSP Scriptlets
Scriptlet tags are the easiest way to put java code in a JSP page. A scriptlet tag
starts with <% and ends with %>.
Any code written inside the scriptlet tags go into the _jspService() method. For
example:
<%
Date="+d);
%>
3. JSP Expression
Since most of the times we print dynamic data in JSP page
using [Link]() method, there is a shortcut to do this through JSP Expressions.
JSP Expression starts with <%= and ends with %>.
4. JSP Directives
JSP Directives are used to give special instructions to the container while JSP page is
getting translated to servlet source code. JSP directives starts
with <%@ and ends with %>
For example, in above JSP Example, I am using page directive to to instruct container
JSP translator to import the Date class.
5. JSP Declaration
JSP Declarations are used to declare member methods and variables of servlet
class. JSP Declarations starts with <%! and ends with %>.
For example we can create an int variable in JSP at class level as <%! public
static int count=0; %>
JSP supports nine automatically defined variables, which are also called implicit objects. These
variables are:
Objects Description
out This is the PrintWriter object used to send output to the client.
JSP Directives:
A JSP directive affects the overall structure of the servlet class. It usually has the following
form:
Directive Description
<%@ include ... %> Includes a file during the translation phase.
There is only one syntax for the Action element, as it conforms to the XML standard:
Action elements are basically predefined functions and there are following JSP actions
available:
Syntax Purpose
To give an example for a JSP code, first we are going to print the text "Hello Hiox". Try the the
following syntax code.
Example :
<html>
<body>
<! -- This is the JSP file-->
<%
[Link] ("Hello HIOX");
%>
</body>
</html>
Result :
Hello HIOX
JSTL
Advantage of JSTL
1. Fast Developement JSTL provides many tags that simplifies the JSP.
2. Code Reusability We can use the JSTL tags in various pages.
3. No need to use scriptlet tag It avoids the use of scriptlet tag.
JSTL Tags
There JSTL mainly provides 5 types of tags:
31
Core tags The JSTL core tag provide variable support, URL management, flow
control etc. The url for the core tag
is [Link] . The prefix of core tag is c.
Function The functions tags provide support for string manipulation and string
tags length. The url for the functions tags
is [Link] and prefix is fn.
Formatting The Formatting tags provide support for message formatting, number
tags and date formatting etc. The url for the Formatting tags
is [Link] and prefix is fmt.
XML tags The xml sql tags provide flow control, transformation etc. The url for
the xml tags is [Link] prefix is x.
SQL tags The JSTL sql tags provide SQL support. The url for the sql tags
is [Link] and prefix is sql.
AJAX:
AJAX stands for Asynchronous JavaScript and XML. AJAX is a new technique for creating
better, faster, and more interactive web applications with the help of XML, HTML, CSS, and Java
Script.
Ajax uses XHTML for content, CSS for presentation, along with Document Object
Model and JavaScript for dynamic content display.
Conventional web applications transmit information to and from the sever using
synchronous requests. It means you fill out a form, hit submit, and get directed to a
new page with new information from the server.
With AJAX, when you hit submit, JavaScript will make a request to the server,
interpret the results, and update the current screen. In the purest sense, the user would
never know that anything was even transmitted to the server.
XML is commonly used as the format for receiving server data, although any format,
including plain text, can be used.
AJAX is a web browser technology independent of web server software.
A user can continue to use the application while the client program requests information
from the server in the background.
Intuitive and natural user interaction. Clicking is not required, mouse movement is a sufficient
event trigger.
JSP Architecture
JSP architecture gives a high-level view of the working of JSP. JSP architecture is a 3 tier architecture.
It has a Client, Web Server, and Database. The client is the web browser or application on the user side.
Web Server uses a JSP Engine i.e; a container that processes JSP. For example, Apache Tomcat has a
built-in JSP Engine. JSP Engine intercepts the request for JSP and provides the runtime environment for
the understanding and processing of JSP files. It reads, parses, build Java Servlet, Compiles and
Executes Java code, and returns the HTML page to the client. The webserver has access to the
Database. The following diagram shows the architecture of JSP.
Now let us discuss JSP which stands for Java Server Pages. It is a server-side technology. It is used for
creating web applications. It is used to create dynamic web content. In this JSP tags are used to insert
JAVA code into HTML pages. It is an advanced version of Servlet Technology. It is a Web-based
technology that helps us to create dynamic and platform-independent web pages. In this, Java code can be
inserted in HTML/ XML pages or both. JSP is first converted into a servlet by JSP container before
process JSP Processing is illustrated and discussed in sequential steps prior to
which a pictorial media is provided as a handful pick to understand the JSP processing better which is as
follows:
Step 1: The client navigates to a file ending with the .jsp extension and the browser initiates an HTTP
request to the webserver. For example, the user enters the login details and submits the button. The
browser requests a [Link] page from the webserver.
Step 2: If the compiled version of JSP exists in the web server, it returns the file. Otherwise, the request is
forwarded to the JSP Engine. This is done by recognizing the URL ending with .jsp extension.
Step 3: The JSP Engine loads the JSP file and translates the JSP to Servlet(Java code). This is done by
converting all the template text into println() statements and JSP elements to Java code. This process is
called translation.
Step 4: The JSP engine compiles the Servlet to an executable .class file. It is forwarded to the Servlet
engine. This process is called compilation or request processing phase.
Step 5: The .class file is executed by the Servlet engine which is a part of the Web Server. The output is
an HTML file. The Servlet engine passes the output as an HTTP response to the webserver.
Step 6:
What is JSP?
In Java, JSP stands for Java Server Pages. It is a server-side technology which is used for creating web applications. It
is used to create dynamic web content. JSP consists of both HTML tags and JSP tags. In this, JSP tags are used to insert
JAVA code into HTML pages. It is an advanced version of Servlet Technology i.e. a web-based technology that helps
us to create dynamic and platform-independent web pages. In this, Java code can be inserted in HTML/ XML pages or
both. JSP is first converted into a servlet by the JSP container before processing the request. JSP has various
features like JSP Expressions, JSP tags, JSP Expression Language, etc.
How JSP more advantageous than Servlet?
They are easy to maintain.
No recompilation or redeployment is required.
Less coding is required in JSP.
JSP has access to the entire API of JAVA.
JSP are extended version of Servlet.
Features of JSP
Coding in JSP is easy : As it is just adding JAVA code to HTML/XML.
Reduction in the length of Code : In JSP we use action tags, custom tags etc.
Connection to Database is easier : It is easier to connect website to database and allows to read or
write data easily to the database.
Make Interactive websites : In this we can create dynamic web pages which helps user to interact
in real time environment.
Portable, Powerful, flexible and easy to maintain : as these are browser and server independent.
No Redeployment and No Re-Compilation : It is dynamic, secure and platform independent so no
need to re-compilation.
Extension to Servlet : as it has all features of servlets, implicit objects and custom tags
1. Declaration Tag : It is used to declare variables.
2. Java Scriplets : It allows us to add any number of JAVA code, variables and expressions.
3. JSP Expression : It evaluates and convert the expression to a string.
4. JAVA Comments : It contains the text that is added for information which has to be ignored.
Create html page from where request will be sent to server eg [Link].
To handle to request of user next is to create .jsp file Eg. [Link]
Create project folder structure.
Create XML file eg [Link].
Create WAR file.
Start Tomcat
Run Application
5. It does not require advanced knowledge of JAVA
6. It is capable of handling exceptions
7. Easy to use and learn
8. It contains tags which are easy to use and understand
9. Implicit objects are there which reduces the length of code
10. It is suitable for both JAVA and non JAVA programmer
11. Difficult to debug for errors.
12. First time access leads to wastage of time
13. output is HTML which lacks features.
INTRODUCTION TO JAVA BEANS
Software components are self-contained software units developed according to the motto them
once, run and reused them Or in other words, reusability is the main concern behind the
component model.
A software component is a reusable object that can be plugged into any target software application.
You can develop software components using various programming languages, such as C, C++, Java, and Visual
Basic.
A is a reusable software component model based on java bean specification that can be
manipulated visually in a builder tool.
The term software component model describe how to create and use reusable software components to
build an application
Builder tool is nothing but an application development tool which lets you both to create new beans or
use existing beans to create an application.
To enrich the software systems by adopting component technology JAVA came up with the concept
called Java Beans.
Java provides the facility of creating some user defined components by means of Bean programming.
We create simple components using java beans.
We can directly embed these beans into the software.
Builder tools allow a developer to work with JavaBeans in a convenient way. By examining a JavaBean by a
process known as Introspection, a builder tool exposes the discovered features of the JavaBean for visual
manipulation. A builder tool maintains a list of all JavaBeans available. It allows you to compose the Bean into
applets, application, servlets and composite components (e.g. a JFrame), customize its behavior and
appearance by modifying its properties and connect other components to the event of the Bean or vice versa.
Some Examples of Application Builder tools:
Java Workshop2.0 Sun MicroSystems., Inc., Complete IDE that support applet,
application and bean development
The classes and interfaces defined in the [Link] package enable you to create JavaBeans.
The Java Bean components can exist in one of the following three phases of development:
Construction phase
Build phase
Execution phase
It supports the standard component architecture features of
Properties
Events
Methods
Persistence.
In addition Java Beans provides support for
Introspection (Allows Automatic Analysis of a java beans)
Customization(To make it easy to configure a java beans component)
Elements of a JavaBean:
Properties
Similar to instance variables.
A bean property is a named attribute of a bean that can affect its behavior or appearance. Examples of
bean properties include color, label, font, font size, and display size.
Methods
Same as normal Java methods.
Every property should have accessor (get) and mutator (set) method.
All Public methods can be identified by the introspection mechanism.
There is no specific naming standard for these methods.
Events
Similar to Swing/AWT event handling.
The JavaBean Component Specification:
Customization: Is the ability of JavaBean to allow its properties to be changed in build and execution phase.
Persistence:- Is the ability of JavaBean to save its state to disk or storage device and restore the saved state
when the JavaBean is reloaded.
Communication:-Is the ability of JavaBean to notify change in its properties to other JavaBeans or the
container.
Introspection:- Is the ability of a JavaBean to allow an external application to query the properties,
methods, and events supported by it.
BeanInfo
Methods
Events
Component
Properties
Customizer
Beans Development Kit
Is a development environment to create, configure, and test JavaBeans.
The features of BDK environment are:
Provides a GUI to create, configure, and test JavaBeans.
Enables you to modify JavaBean properties and link multiple JavaBeans in an application
using BDK.
Provides a set of sample JavaBeans.
Enables you to associate pre-defined events with sample JavaBeans.
BeanBox window:
Is a workspace for creating the layout of JavaBean application.
The following figure shows the BeanBox window: