Java Reference
In-Depth Information
L ISTING 8.2
Continued
<td>Subject</td>
<td>
<input type=”text” name=”subject” size=”30” maxlength=”30”>
</td>
</tr>
<tr>
<td colspan=”2”>
<textarea cols=”40” rows=”10” name=”body”></textarea>
</td>
</tr>
<tr>
<td>
<input type=”submit” name=”submit” value=”Submit”>
<input type=”Reset”>
</td>
</tr>
</table>
</form>
</body>
</html>
You can see that there is nothing special about this form. You should only notice that the action
attribute of the form points to your servlet, found in Listing 8.3.
L ISTING 8.3
MailServlet.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class MailServlet extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
Search WWH ::




Custom Search