import java.io.*;
import javax.servlet. ;import java.util. ;
открытый класс FirstServlet extends GenericServlet {public void init () throws ServletException {}
@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
//set response content type
res.setContentType("text/html");
//get PrinterWriter Object
PrintWriter pw=res.getWriter();
//write response
Date d=new Date();
try {
Thread.sleep(40000);
} catch (Exception e) {
// TODO: handle exception
}
pw.println("<br>our servlet class(Date Servlet); object hashcode "+this.hashCode());
pw.println("<br> request object hash code"+this.hashCode());
pw.println("<br> response object hashcode"+res.hashCode());
pw.println("<br>current thread hashcode"+res.hashCode());
pw.println("<b><i><center>Date and Time is "+d+" </b></i></center>");
pw.println("Welcome to servlet programming");
//close stream
pw.close();
}//service(-,-)
} // класс