Easiest Way to Run Servlet
|
|
|
Question / Problem
|
How do you run a servlet?
|
Solution
|
|
Servlets are either invoked as an explicit URL reference or are embedded in HTML and invoked from a Web application. You don't execute a Java command to run a servlet (as you would an applet); instead, you issue a URL command pointing to the location of the servlet.
Servlets are located in any directory on a machine where an application server is
running. Typically, there is a servlet directory to which you will ftp or copy your class files so the application server can find them. This location can be configured differently, depending on the administrator and the environment.
Servlets are loaded when they are invoked for the first time from a client.
Alternatively,they can be loaded when the application server is started; this is a configuration decision. The server must support the version level at which you've written your Java servlets.
Most servers support servlets written based on the Java Servlet Development Kit
(JSDK) Version 2.1. Many are starting to support Version 2.2, which is the latest
revision of the Java Servlet API Specification (Version 2.3 is under review).
|
Applies to |
|
Servlet
|
Rank It |
|