This module discusses how to write servlets.
You have learned what servlets are and how they work, and you have installed and configured all your software.
After completing this module you will be able to:
- Generate HTML from a servlet
Mix static and generated HTML on the same Web page
Maintain state in a servlet
Include the current time on a Web page
Recognize the HTML that generates a form
Use form data in a servlet
A servlet can find out much about the server in which it is executing. It can learn the
- listening port, and
- server software.
A servlet can display this information to a client, use it to customize its behavior based on a particular server package, or even use it to explicitly restrict the machines on
which the servlet will run.
public String ServletContext.getServerInfo()
public Object ServletContext.getAttribute(String name)