Information Technology Reference
In-Depth Information
Web client's requests into object-based requests and, in reverse, the object-
based responses back to the Web client via HTTP.
Servlets provide a more effective alternate mechanism to the traditional
CGI scripts for interaction between the server-based business logic and the
Web-based clients. Servlets are usually employed to handle preliminary
tasks like gathering and checking for valid inputs from the entry fields of a
Web page. Once the basic checks are completed, the data are then passed on
to more suitable component(s) for actual processing.
JSP specification provides the JSP with the same capabilities as
the servlet. The basic idea is to leverage JSP for presentation-
centric tasks and utilize the servlets for business logic processing-
centric tasks. Servlets are preferred for more logical tasks as they
are also comparatively easier to debug. Since Java code is embedded
within the JSP, it may seem that the separation of presentation from
business logic is not realistic. JSP should primarily be focused on pre-
sentation, and any Java code embedded within the JSP should primar-
ily be for communication with servlets, other control or data entities,
and so on.
JSP development usually adopts the Model 2 architecture based on
the Model-View-Controller (MVC) architecture discussed earlier. It
uses one or more servlets as controllers; requests received by frontline
servlet(s) are redirected to the concerned JSPs. Usually JavaBeans is
used as the model that acts as the conduit to pass information between
the controller servlet(s) and the JSPs. The controller fills in the JavaBean
based on the request, and the JSP in turn composes the actual page
using values from the JavaBean.
6.2.4.1.3 Enterprise JavaBeans (EJB)
EJB components encapsulate business logic. EJB defines a comprehensive
component model for building scalable, distributed server-based enterprise
Java application component.
EJB components have four parts:
1. An implementation class that contains the business logic.
2. Home and remote interfaces that present the EJB's methods to the
outside world.
3. A deployment descriptor: An XML file that is used to configure
the EJB component being deployed in a J2EE server. For example, a
deployment descriptor can define the security properties or transac-
tion properties of EJB methods.
 
Search WWH ::




Custom Search