Unit-11: JSP Programming

  1.Write a JSP program to display the current server time. Jsp program: <HTML> <BODY> <% java.util.Calendar now = java.util.Calendar.getInstance(); int hour = now.get( java.util.Calendar.HOUR_OF_DAY); int minute = now.get( java.util.Calendar.MINUTE); int second=now.get( java.util.Calendar.SECOND); %> <h1>Current Server Time</h1> <% out.println(hour +”:”+minute+”:”+second); %> </BODY> </HTML>   2.JSP Implicit Object Crete a HTML form with two textfied for […]

Continue Reading

Unit-10 :Servlet

java servlet write a servlet program to display the current system date time. 1. Servlet Program import javax.servlet.*; import java.io.*; import java.util.*; public class ServletDemo extends GenericServlet { public void service(ServletRequest rq, ServletResponse rsp) throws ServletException, IOException { PrintWriter pw=rsp.getWriter(); rsp.setContentType(“text/html”); Date dt=new Date(); pw.println(“<html>”); pw.println(“<body>”); pw.println(“Current date time=”+dt); pw.println(“</body>”); pw.println(“</html>”); pw.close(); } } 2. […]

Continue Reading