Generating XML from an HTML Form

Processing form data is one of the primary tasks performed by servlets. In our Aphorisms site, a servlet will process the Add an Aphorisms form pictured in Figure 9.2. Listing 9.3 contains the HTML source for the Add an Aphorism form. The form contains three text lines, a choice input item, and two text areas.

Figure 9.2. The Add an Aphorism HTML form.

Code Listing 9.3. AddAphorismForm.htm
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <TITLE> Aphorism Submission Form </TITLE> </HEAD> <BODY> <FORM ACTION="http://localhost:8080/examples/servlet/sams.chp9.ProcessAphorismForm" METHOD="POST"> <P ALIGN="CENTER"><B><FONT ...

Get XML Development with Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.