Best Practices

There are many options and various situations that Web components can be used for. In general, the Web tier is used mainly for processing user input, server-side validation, and building dynamic content. It's not a good place to put application business logic, access the database, or perform transactions. All Web components are not transactional. Use EJBs to model your application business logic.

Don't put too much logic in JSPs. Use taglibs to capture presentation logic, and JavaBeans as data transfer objects between the Web tier and the EJB tier. Use servlets as controllers as well as delegates on behalf of the client to the EJB tier.

When tracking user sessions, try to activate URL rewriting to avoid disabled cookies by users. ...

Get Sams Teach Yourself EJB 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.