Choosing Between Servlets and Java Server Pages

Although you've just barely scratched the surface of JSP and servlets, now is a good time to talk about when to use servlets, when to use JSP, and when to use both. To make such decisions, you need to weigh the advantages and disadvantages of each. Remember, too, that because Java Server Pages are translated into servlets, they can't be all that different when you get right down to it.

The Advantages and Disadvantages of JSP

The biggest strength of JSP is that it looks like HTML (or XML or whatever kind of content you are generating). You can give a JSP to someone who is familiar with HTML and expect that person to be able to make changes in a fairly short amount of time. It is also obvious what ...

Get Special Edition Using Java™ 2 Enterprise Edition 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.