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? And which type would I use to contain data and its associated operations?
A2: For pure business logic, you would typically use a session bean (or a message-driven bean). If the EJB is to represent underlying application data, you would probably use an entity bean.
Q3:Why are JSPs generally faster than other server-side scripting environments?
A3: When a JSP is accessed, it is compiled into Java bytecodes. Every subsequent access will use the bytecodes rather than processing the page again. This means that JSPs will run as fast as standard Java classes such as servlets.
Q4:What are the consequences of producing a J2EE application with vendor specific APIs?
A4: The application you produce will become specific to a particular container, server, or vendor. You will not be able to easily move the application from platform to platform.
Q5:How do you package an EJB? What should be in the package?
A5: An EJB is packaged in an EJB-JAR file. The EJB-JAR file contains the classes for the EJB, any other resources, and a deployment descriptor that contains EJB metadata and describes the external resource requirements of the EJB.
Q6:What is an EAR file?
A6: This is an Enterprise Application Resource file that houses the application's JAR, WAR, and XML files. The Assembler takes on the responsibility of packaging the EAR file, while the Deployer authenticates that the file conforms to the J2EE specification, adds the file to the J2EE server, and deploys the application.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.48.204