Name

Monolithic/Compound JSPs

Mistake

A single JSP page performs duties of model, view, and controller, making the page large and difficult to maintain.

Watch for It When

JSP pages are large and complicated, JSP pages contain a large amount of embedded logic, JSP pages directly connect to databases or other external resources, or JSP pages contain lots of if/then statements.

Solution

Refactor into the MVC architecture. Separate all output generation into JSP pages or separate servlets. Separate calls to business data into reusable actions. Coordinate input processing, actions, and views with servlets.

Get J2EE Design Patterns 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.