The J2EE specification attempts to fill the gaps between the web components and Enterprise JavaBeans by defining how these technologies come together to form a complete platform.
One of the ways in which J2EE adds value is by creating a consistent
programming model across web components and enterprise beans through
the use of the JNDI ENC and XML deployment descriptors. A servlet in
J2EE can access JDBC
environment entries, and references to enterprise beans through a
JNDI ENC in exactly the same way that enterprise beans use the JNDI
ENC. To support the JNDI ENC, web components have their own XML
deployment descriptor that declares elements for the JNDI ENC
env-entry) as well security roles and other
elements specific to web components. In J2EE, web components
(Servlets and JSP pages) along with their XML deployment descriptors,
are packaged and deployed in
JAR files with the extension
stands for web ar chive.
The use of the JNDI ENC, deployment descriptors,
and JAR files in web components makes them consistent with the EJB
programming model and unifies the entire J2EE platform. Here is a
simple deployment descriptor for a web component:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_1_2.dtd"> <web-app> <servlet> <servlet-name> HelloWorld </servlet-name> <servlet-class> HelloWorld.class </servlet-class> </servlet> <servlet-mapping> ...