Working Effectively with Servlets
We start with a look at servlet frameworks. Frameworks (e.g., Apache
Struts) are becoming increasingly popular because they increase
programmer efficiency by providing a skeleton on which applications
can be built. In the first section, we examine what servlet
frameworks offer, and I give a quick overview of the most popular
frameworks. After that, we jump from the high level to the low level
with a discussion on how using pre-encoded characters can optimize
your servlet’s performance. Next, we tackle the
thorny issue of loading configuration files and provide some code to
make the task easier, and after that I give some tips on when you
should (or should not) use the HttpSession and
SingleThreadModel features. As we near the end of
the chapter, I explain how to reliably control caching to improve the
user’s experience. Then I address the frequently
asked question: “How do I download a file to the
client so that the client sees a `Save
As’ pop up?” As
you’ll see, the answer lies in setting the right
HTTP headers.