EJB Introduction
Program. Restrictions
Stateless Session Bean
Stateless ...(Example-1)
Stateful Session Bean
Stateful ... (Example-2)
Entity Beans
BMP Entity Beans
Config. DB (Example-3)
BMP (Example-4)
Bookmark This Site
|
Stateless Session Beans - Complete Project (Continue...)
Introduction
|
- To improve performance, you might choose a stateless session bean if it has any of these traits:
-
The bean’s state has no data for a specific client.
-
In a single method invocation, the bean performs a generic task for all clients. For example, you might use a stateless session bean to send an email that confirms an online order.
-
The bean fetches from a database a set of read-only data that is often used by clients. Such a bean, for example, could retrieve the table rows that represent the products that are on sale this month.
- Types of Enterprise Beans are
-
- Session Beans
- Stateless Session Beans
- Stateful Session Beans
- Entity Beans
- Bean Managed Persistent (BMP) Entity Beans
- Container Managed Persistent (CMP) Entity Beans
- Message-Driven Bean
CLICK HERE to download this complete example (zip file)
|
|
Steps to deploy and run this Stateless Session Bean - Continue ...
|
- Next, goto File -> New -> Web Component
 (Click Next button)
 (Enter the WAR Name as "SlsApp" and then click the Edit Contents… button)
- Select only the Loan.html and LoanServlet.class files and click the Add button

 (Now click the Next button)
 (Now select the Servlet option button and then click the Next button)
 (Now select the "LoanServlet" from the Servlet Class dropdown box)
 (Now select the Next button)
 (Now select the Finish button)
 (Now select the SlsApp in the left pane and select the General tab in the right pane. Here give a name "/loanctx" in the Context Root text box)
- Next select the StatelessBeanExample in the right side
 (Now select the StatelessBeanExample in the left pane and then select the Aliases tab in the right pane. Next select the Add button)
 (Now add a name as "servlet/LoanServlet")

- Select the WebApp in the left pane and then select the File Refs tab in the right pane

- Now click the Add File button in the Welcome Files pane and then select the Loan.html file from the drop-down box

- Now, select the General tab
 ( Now press Alt+S or Sun-specific Settin… button ) -
Now a Sun-specific Settings will open as in the below picture. Here, in the Application pane specify "ejb/SimpleLoan" in the JNDI Name
 ( Now press the Close button )
- Now goto File ->Save
- Next goto Tools -> Deployee
 (Enter the User Name as “admin” and Password as “password” (CLICK HERE for password). Next click the OK button)
 (Now a message --- Operation Completed Successfully --- must display. Next click the Close button)
- Next goto File -> Exit to close it
- Open the Internet Explorer and type the address as http://localhost:8080/ loanctx
-
Program completed
- To stop the server goto Start -> All Programs -> Sun Microsystems -> Application Server PE -> Stop Default Server. CLICK HERE to see how to Stop the Server
|
|
Click for Next Topic
|
|
|