Summary

Today, you have seen how servlets can be employed in a Web application to add dynamic content to HTML pages. You learned that servlets have no client interface, and the servlet container controls its lifecycle. Because HTTP is a stateless protocol, servlets have to use external means to retain information between page accesses. Cookies are one method, but when cookies cannot be used, a servlet can use hidden fields or URL rewriting. You have also seen that with event listening and using servlet filters, you can further extend the functionality and reusability of your servlet Web applications.

Servlets generate HTML from within Java code. This works well when the amount of HTML is relatively small, but the coding can become onerous if ...

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