Java Reference
In-Depth Information
calls, to send each snippet of HTML separately. The output can be flushed
explicitly, too, using
response.flushBuffer();
You might do such a call just before beginning a database operation, or
place such calls at strategic points through your output.
18.8
R EVIEW
We have seen that servlets are Java programs that are run by a Web server. They
typically, but not necessarily, produce output intended for a browser. By imple-
menting the HttpServlet interface, your Java class will have all the methods
needed for it to be run by a Web server. We looked at a simple example and
saw its output to a Web browser, then we looked at another example using our
BudgetPro application.
18.9
W HAT Y OU S TILL D ON ' T K NOW
There is more that we haven't discussed, so if you're going to do some serious
work with servlets, be sure to do some additional reading, especially on these
topics:
• The servlet lifecycle and the need for thread safety.
• How to keep the servlet output from being cached.
• Dealing with failures.
• Initialization parameters.
• Other kinds of output.
• Sharing between servlets.
• How to configure and deploy servlets (this is coming up in the next
chapter).
Search WWH ::




Custom Search