20.1. JSP Overview

JavaServer Pages (JSP) technology enables you to mix regular, static HTML with dynamically generated content from servlets. You simply write the regular HTML in the normal manner, using familiar Web-page-building tools. You then enclose the code for the dynamic parts in special tags, most of which start with <% and end with %>. For example, here is a section of a JSP page that results in “Thanks for ordering Core Web Programming” for a URL of http://host/OrderConfirmation.jsp?title=Core+Web+Programming:

Thanks for ordering <I><%= request.getParameter("title") %></I>

Separating the static HTML from the dynamic content provides a number of benefits over servlets alone, and the approach used in JavaServer Pages offers several ...

Get Core Web Programming, Second 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.