37 lines
1.5 KiB
HTML
37 lines
1.5 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
|
<html>
|
||
|
<head>
|
||
|
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
|
||
|
|
||
|
<title>Extend the HttpServlet class</title>
|
||
|
</head>
|
||
|
|
||
|
<BODY>
|
||
|
<!-- Java sync-link -->
|
||
|
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
||
|
|
||
|
<h6><A NAME="servclss"></A>Extend the HttpServlet class</h6>
|
||
|
|
||
|
|
||
|
<p>After the import statements, type the class declaration (in black text below):</p>
|
||
|
|
||
|
<pre><font color="#808080" class="code">import java.io.*;
|
||
|
import java.util.*;
|
||
|
import javax.servlet.*;
|
||
|
import javax.servlet.http.*;</font>
|
||
|
|
||
|
public class ServletSample extends HttpServlet
|
||
|
{
|
||
|
|
||
|
}
|
||
|
</pre>
|
||
|
|
||
|
<p>The example, ServletSample, extends the javax.servlet.http.HttpServlet class of the javax.servlet.http package. Java requires the declared classname to match the name of the java file ServletSample.java. The HttpServlet class, which is a subclass of GenericServlet, provides specialized methods for handling HTML forms. HTTP servlets enable you to send and receive data using an HTML form.</p>
|
||
|
|
||
|
<p>HTML forms are defined by the <FORM> and </FORM> tags. The forms typically include input fields (such as text entry fields, check boxes, radio buttons, and selection lists) and a button to submit the data. They also specify which program or servlet the server should run when the information is submitted.</p>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|