13 Techniques of the Java EE (specification)
Java Database Connection (JDBC)
The JDBC API accesses various databases in a unified manner. Like ODBC, JDBC isolates the problems between developers and private databases. Because it is built on Java, JDBC can provide platform-agnostic database access.
JDBC defines 4 different drivers, specifically, including:
Type 1:JDBC-ODBC Bridge
The Jdbc-odbc bridge is very useful when JDBC is first created. With it, developers can use JDBC to access an ODBC data source. The downside is that it needs to have an ODBC driver installed on the client machine, which is usually supposed to run the Microsoft Windows system. With this type of drive, you lose the benefit of JDBC platform-agnostic. Additionally, the ODBV drive requires client management.
Type 2:jdbc-native Drive Axle
The Jdbc-native Drive Bridge provides a JDBC interface for building on the local database driver-no ODBC is used. The JDBC driver transforms a standard JDBC call into a local call to the database API. Using type 2 drivers also loses the benefit of JDBC platform independence and requires local code to be installed on the client.
Type 3:jdbc-network Bridge
The Jdbc-network bridge does not require a client-side database driver. They use the network-server middle tier to access a database. This leads to technologies such as load balancing, connection pooling, and data buffering is also possible. Because the driver of type 3 typically brings relatively small download times, it is platform-independent and does not require client installation and management, making it ideal for use as an Internet application.
Type 4: pure Java Driver
Type 4 uses a pure Java database driver to provide direct database access. Because the Type 4 driver runs on the client and accesses the database directly, running in this mode implies a two-tier system to use. To use the driver of type 4 in an n-tier system, you can pass an EJB that contains data access code and have the EJB provide a database-agnostic service to its customers.
Java naming and Directory interfaces (Java naming and directory Interface,JNDI)
Jndi is a shorthand for Java naming and directory interface: Java naming and Directory interface, which is intended for access to the directory infrastructure used in advanced Web application development. In fact, this directory is a special database that provides quick access to stored data, unlike traditional directory service access-you must provide different API interfaces to access different directory services (e.g., ldap,nis,ads, etc.), and it provides a standard API to access different types of directories. It is said that using the full SDK can develop directory service providers that are not supported by Jndi.
Jndi is an API for the Java EE and provides a standard set of interfaces to locate users, machines, networks, objects, and services. For example, you can use Jndi to locate a printer in your intranet, or you can use it to locate Java objects or connect to a database. Jndi can be used in EJBs, RMI-IIOP, and JDBC. It is the standard method for locating network lookups. The JNDI API is used to access the naming and directory services. It provides a consistent pattern to access and manipulate large enterprise-wide resources, such as DNS, LDAP, local file systems, or objects in an application server.
In Jndi, each node in a directory structure is called a context. Each jndi name is relative to a context, without the concept of an absolute name. An app can use the InitialContext class to get its first context:
Context ctx= new InitialContext ();
With this initial context, the application can navigate through the directory tree to the desired resource or object. For example, suppose you already have an EJB configured in Weblogicserver and the home interface is bound in MYAPP.MYEJB. The EJB client, after getting such an initial context, can then use the following code to navigate to the home interface:
Myejbhomehome = Ctx.lookup ("MYAPP.MYEJB");
Once you get a reference to the object you want-in this case, the home interface of the EJB-then you can invoke the method above it. In order to find an object in a context, Jndi also provides methods to do so:
Inserts or binds an object into a context. This is a very effective method when you configure an EJB;
Remove an object from a context
List all objects in a context
Create and delete subcontexts
Corporate java Beans(Enterprisejava Beans,EJB)
One of the notable techniques of the Java EE is EJB. It provides a framework for developing and configuring distributed business logic to clients, so it can significantly reduce the difficulty of developing scalable, highly complex enterprise applications. The EJB specification defines how and when EJB components should interact with their containers. The container is responsible for providing common services, such as directory services, transaction management, security, resource pooling, and fault tolerance.
The EJB specification defines three basic types of beans:
Session Beans: Session Beans models business processes, because they usually represent an action, so they can be treated as verbs. This action can be anything, such as increasing the number, accessing the database, invoking other systems, and invoking other enterprise beans. We can cite a number of examples, including a pricing engine, a workflow engine, a directory engine, a credit card certification center, or an online securities trading engine.
Entity Beans: This is a representative of persisted data-typically stored in a database-so the data still exists after the server crashes. Multiple clients can use EJBS to represent the same data. Entity beans models Enterprise data because they represent data objects (which are Java objects that cache database information), so they can be used as nouns. Examples of entity beans include a product, an order, an employee, a credit card, or a stock. The typical way of session beans is to achieve business objectives through entity beans, such as a securities trading engine (session beans) that handles stocks (entity beans).
Message-driven Beans:message-driven beans also represents the action, which is similar to the session beans. The difference between them is that you can only invoke them by sending a message to Message-drivenbeans. Examples of Message-drivenbeans include beans, credit authentication messages, or workflow messages that accept stock trading messages. These message-driven beans can also invoke other enterprise beans.
Next, we discuss stateless and stateful
Stateless beans (stateless beans): This is a single-use service that does not maintain any state, is no longer present when the server crashes, and has a relatively short lifetime. For example, a stateless session bean might be used to perform a temperature conversion.
Stateful Bean: It provides a traditional way to interact with the client, storing the state of the client. The online shopping cart is a typical example of a stateful session EAN. Stateful session beans no longer exists when the server crashes, and the lifetime is relatively short, and each instance can only be used in a single thread.
JavaServer Pages (JSPs)
You may already be familiar with Microsoft's active Server Pages (ASPs), and JSP is a similar technique, but it's platform-agnostic. They are designed to help Web content developers create dynamic Web pages with relatively small amounts of code. Web designers can use JSPs to create dynamic Web pages, even if they don't know how to program. Javaserverpage is a mixture of HTML code and Java code. When the customer requests the page, the server processes the Java code and returns the HTML page to the browser.
You can also hear the jhtml, which is an old standard that has now been replaced by JSP. WebLogic server not only supports JSP, but also supports jhtml. However, under the default settings, WebLogic server does not support JSP (for version 5.1). You must edit Weblogic.properties to activate the Web server, which is true for Jspservlet.
Java servlets
Servlets provides the same functionality as most jsps, and it uses a somewhat different approach. Most of the JSP is HTML code, where there is only a small amount of Java code, and Servlets instead, it is completely written in Java, and produces HTML code.
A servlet is a Java applet running on a server that can extend the functionality of a Web server. These server-side applications can be executed dynamically when requested, similar to CGI Perl scripts on traditional Web servers. One of the main differences between CGI scripts and Servlets is that CGI scripts start a completely new process for each request-requiring additional overhead-while the servlet executes as long as it starts a separate thread within the servlet engine. So the servlet is also more extensible.
When you develop a servlet, you usually extend the Javax.servlet.http.HttpServlet class and override some of its methods. Methods of interest include:
Service (): As a scheduler for the Command-specific method
Doget (): Processing an HTTP GET request from a customer
DoPost (): Processing an HTTP POST request from a customer
There are other ways to handle different types of HTTP requests--you can refer to the text of the HttpServlet API to get more relevant information.
Java Idl/corba
With the IDL support from Java, developers can integrate Java with CORBA. They can create Java objects that can be configured in a CORBA orb, or they can create Java classes that are configured as CORBA object clients within other orbs. The latter provides an additional way to integrate your new application with the previous system through Java.
Java Transaction Architecture (JTA)/java Transaction Service (JTS)
JTA defines a standard API that the application can use to access the transaction monitor.
JTS is a basic implementation of CORBA OTS transaction Monitor. JTS Specifies a transaction manager implementation (Transaction Manager) that supports the Java Transaction API (JTA) specification at a high level, and implements the Java mapping of the OMG OTS specification on a low level. A JTS transaction manager provides transaction services for application servers, resource managers, standalone applications, and communication Explorer.
JavaMail and JavaBeans activation Architecture (JavaBeans activationframework ,JAF)
JavaMail is an API used to access the mail server. The JavaMail API provides a set of abstract classes to model a messaging system. Supports SMTP and IMAP servers.
JavaMail handles MIME-encrypted message attachments by using the JavaBeans Activation Framework (JAF). The MIME byte stream and the Java object can be converted to each other. Most applications need no direct use of JAF.
Java Messenger services (Java Messagingservice,JMS)
JMS is an API for middle-level communication with information. It not only supports point-to-point domains, it also supports publish/subscribe domains, and provides support for secured information delivery, transactional information delivery, persistent information, and durablesubscribers. JMS provides another way to integrate your application with the previous backend system.
Extended Markup Language (extensible Markup Language,XML)
XML is a language used to define other markup languages. It can be used as a data sharing between businesses. The development of XML is separate from Java, but its goal is similar to Java, for platform-independent purposes. By combining Java with XML, you can get a completely platform-agnostic solution. Multiple companies work to develop a tight integration between Java and XML. For specific information, you can browse the Java-xml section of the Sun site (http://java.sun.com/xml), as well as the XML Zone section of IBM's Developerworks.
Struts+spring+hibernate (SSH)
13 Techniques of the Java EE (specification)