Java Reference
In-Depth Information
out.println("</HEAD>");
out.println("<BODY>");
out.println("Howdy from MyServlet's doGet method!");
out.println("</BODY>");
out.println("</HTML>");
out.close();
}
protected void doPost(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException, IOException {
getStarted(resp);
out.println("<Title>MyServlet Post Response</Title>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("Employee Number " +
req.getParameter("empNumTF"));
out.println("</BODY>");
out.println("</HTML>");
out.close();
}
public void getStarted(HttpServletResponse resp)
throws IOException {
resp.setContentType("text/html");
out = new PrintWriter(resp.getOutputStream());
out.println("<HTML>");
out.println("<HEAD>");
}
}
Review Questions
1.
What is a servlet?
2.
What is a server?
3.
What is a protocol?
4.
What is HTTP?
5.
How are the Internet and the World Wide Web related?
6.
What are the advantages of server-based applications over client-based applications?
7.
What does a server pass to a servlet?
8.
What are the two primary methods in a servlet?
9.
What is the relationship between a form and a servlet?
10.
What are HTML tags?
 
Search WWH ::




Custom Search