Advance Java Unit-V
Advance Java Unit-V
Java (Servlets):
Read cookies:
2. HttpSession
Points:
Server-side storage.
Unique JSESSIONID cookie is created and used to track sessions.
Can store any Java object as an attribute.
Automatically created when request.getSession() is called.
In Java (Servlets):
Retrieve data:
String username = (String) session.getAttribute("username");
Introduction to EJB
Features:
Simplifies development of distributed, transactional, and secure business applications.
Supports remote access, persistence, concurrency, security, and transaction
management.
Deployed in an EJB container, which provides system-level services (e.g., transactions,
security, lifecycle).
Types of EJBs
1. Session Bean: Session bean contains business logic that can be invoked by local, remote
or webservice client. There are two types of session beans:
(i) Stateful Session bean :
Stateful session bean performs business task with the help of a state. Stateful
session bean can be used to access various method calls by storing the
information in an instance variable. Some of the applications require
information to be stored across separate method calls. In a shopping site, the
items chosen by a customer must be stored as data is an example of stateful
session bean.
(ii) Stateless Session bean :
Stateless session bean implement business logic without having a persistent
storage mechanism, such as a state or database and can used shared data.
Stateless session bean can be used in situations where information is not
required to use across call methods.