Introduction to J2EE APIs

Servlets
- At a high level.- Java Servlets are the Java equivalent of CGI scripts.
- That can be used to perform processing and the servicing of client requests on a web server.
- From an implementation perspective, servlets are simply Java classes.
- That implement a predefined interface.
- One use for servlets is that they can be used to dynamically generate content.
- For presentation to the user.
- And this is achieved by embedding markup language (e.g. HTML) inside the Java code.
- As Servlets are written in Java, they have access to the rich library of features provided by Java.
- Including access to databases and other enterprise resources such as EJB.
Java Server Pages (JSP)
- JSP is another technology for presenting information to the user over the web.- And uses a paradigm where Java code is embedded into the HTML
- The opposite of servlets, and much like Microsoft ASP.
- Pages are written as HTML files with embedded Java source code known as scriptlets.
- One of the pitfalls in using JSP is that it is very easy to build large pages.
- Containing lots of embedded Java code and business logic.
- For this reason, JSPs provide easy integration with JavaBeans and another feature called JSP tag extensions.
- These custom tags (also known as custom actions) allow re-usable functionality to be encapsulated into XML
- Like tags that can be easily used on the pages by both page developers and designers.
Enterprise JavaBeans (EJB)
- EJB is a major part of the J2EE specification.- And defines a model for building server-side, reusable components.
- There are three types of enterprise beans currently supported by J2EE :
1) Session beans,
2) Entity beans and
3) Message-driven beans.
- Session beans can be seen as extensions to the client application.
2) Entity beans and
3) Message-driven beans.
- Session beans can be seen as extensions to the client application.
- And are typically used to model business processes.
- There are two types of session bean :
1) Stateful and
2) Stateless.
- Stateful session beans are typically used to record conversational state for a single client between requests.
- Whereas stateless session beans are shared between any number of clients at any one time.
- Entity beans are typically used to model persistent business entities.
- And, in particular, data in a database.
- A common mapping is to model an entity bean on a table.
- There being one instance of that bean for every row in the table.
- There are two ways that persistence can be achieved :
1) Container managed and
2) Bean managed persistence.
- In container managed persistence, a mapping is defined at deployment time.
- Between the persistent properties in the bean and the columns in the table.
- With bean managed persistence, developers write the JDBC code that performs the create, read, update and delete operations.
- Finally, message-driven beans allow functionality to be executed on an asynchronous basis.
- Typically triggered by JMS messages from message-oriented middleware.
Java Message Service (JMS)
- JMS is Java API that presents an interface into message-oriented middleware such as :1) IBM MQSeries,
2) SonicMQ and
3) so on.
- Like JDBC, JMS provides Java applications a mechanism to integrate with such systems by presenting a common programming interface.( Irrespective of the underlying messaging system).
- Functionally, JMS allows messages to be sent and received using a point-to-point or publish/subscribe paradigm.
Java Mail
- The Java Mail API provides classes that allow we work with e – mail.- Specifically it allows sending & receiving e – mail by using a wide variety of protocols. Such as:
1) POP
2) SMTP
3) IMAP
- We can create e – mails that conform to a large number of MIME type.
- MIME – Multi Purpose Internet Mail Extension.
- Because the API uses JAF to provide support for a number of MIME types.
- JAF – Javabean Activation Framework.
- We can create HTML messages that contain embedded graphics & even have attachments.
- Most internet application requires the ability to send e – mail messages.
- We can use this API together with JAF to send from :
1) JSP
2) Servlets or
3) EJB
Java Server Faces (JSF)
- This technology is a user interface framework for building web applications.- The main component of JSF technology is as follows:
1) A GUI component framework :
§ A flexible model for rendering components in different kinds of HTML or different markup languages & technologies.
§ A Rendered (turn into) object generates the markup to render the component.
§ And converts the data that can be represented in a view.
- So, JSF does :
1) A standard rendered kit for generating HTML markup.
2) Input validation.
3) Event handling.
4) Data conversion between model objects & components.
5) Page navigation configuration.
Java Naming Directory Interface (JNDI)
- It is an extension to the Java platform.- And provide multiple naming & directory services.
- A naming services provides a mechanism for locating distributed objects.
- A director services organize the distributed objects & other resources. Such as:
1) Files in to a hierarchical structures.
- Directory services allow resources to be linked virtually.
- So as to be located in directory service hierarchy.
- They are different types of directory services.
- JNDI allows the different types of directory services to be linked.
- Thus client can any type of directory services.
No comments:
Post a Comment