Head First Servlets and JSP
Just got this book today and I typed in the Project1 example. After I
fixed the errors by looking at the book's site and reviewing the
errata, I still have an error. Has anyone else had issues typing in
the examples in the book?
For those of you who aren't familar with the book, here is the Java
program they ask to type in and compile
--------
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Ch1Servlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException {
PrintWriter out = response.getWriter();
java.util.Date today = new java.util.Date();
out.println("<html> " +
"<body>" +
"<h1 align=center>HF\'s Chapter1 Servlet</h1>"
+ "<br>" + today + "</body>" + "</html>");
}
}
--------------
and here is the web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
Version="2.4">
<servlet>
<servlet-name>Chapter1 Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Chapter1 Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
</servlet-mapping>
</web-app>