SERVLET PROGRAM TO DISPLAY DATE AND TIME
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import java.util.*;
import javax.servlet.*;
public class NewServlet extends HttpServlet
{
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out=response.getWriter();
Date d=new Date();
String s=d.toString();
out.println("<b>Date and Time:"+s+"</b>");
out.close();
}
}
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import java.util.*;
import javax.servlet.*;
public class NewServlet extends HttpServlet
{
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out=response.getWriter();
Date d=new Date();
String s=d.toString();
out.println("<b>Date and Time:"+s+"</b>");
out.close();
}
}
Comments
Post a Comment