Just I would like to know,what is the actual purpose of using EJB...I can obtain the business logic using Servlets or JSP....
the real purpose and advantages of EJB are insulation of data layer using EJB and free from system-level concurrency/transaction programming.
EJB is comparable to MTS.
You have to understand the essence of a multitier app, like a thin client, web tier, business tier and the data source or EIS to understand where EJB fits in. EJB-Business tier
Think about a full fledged distributed object system and you will get the power of EJB
I would like to add to the privious replies. The question that you should be asking is. How reusable is a servlet? How componentized (if such a word exists) is a Servlet? Can you change a servlet with out effecting the rest of your application.
When you talk about a component, you are only intrested in the services offered by the component and not its implementation. The application that uses the component depends only on the services offered it and not the implementation. The implementation can change without effecting the application. Therein is the strenght of EJB.