Q&A

Q1: Can a J2EE application be written without using any Enterprise JavaBeans?
A1: Certainly. You can write a client application that connects to a servlet in a Web container and have that servlet connect directly to a back-end database. You don't need to add an EJB. An EJB can add value by providing persistent conversational state if that is required. It can also provide transactional security and roll back to a previous state should there be an interruption in the flow of data for any reason. Therefore, you can use servlets and JSPs on their own if a database is simply read, but any updates or new records to be added will more safely be done using Enterprise JavaBeans.
Q2:What type of EJB should I typically use to encapsulate business logic? ...

Get Sams Teach Yourself J2EE™ in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.