Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
68
Chapter 3 Handling the Client Request: Form Data
Figures 3 1 and 3 2 show the result of the HTML front end and the serv
let, respectively.
Listing 3.1 ThreeParams.java
package coreservlets;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ThreeParams extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Reading Three Request Parameters";
out.println(ServletUtilities.headWithTitle(title) +
"\n" +
"" + title + "
\n" +
"
" param1: "
+ request.getParameter("param1") + "\n" +
" param2: "
+ request.getParameter("param2") + "\n" +
" param3: "
+ request.getParameter("param3") + "\n" +
"\n" +
"