Results 1 to 4 of 4

Thread: Update time with Servlet

  1. #1
    Join Date
    Nov 2009
    Posts
    680

    Update time with Servlet

    I want the source code which will help me to get the updated time with the help of servlet. If anyone is having such type of code. Then please reply me with that code. I am waiting for your reply. If anyone has some idea from which I can get the knowledge about the program then also you can give it to me. Reply me as soon as possible.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Update time with Servlet

    I have a code which will help you to update time with the use of servlet. Make use of it, it is simple one and need not to explain it.

    Code:
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    
    public class Updatetime extends HttpServlet 
    {
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException 
    {
    PrintWriter pw = response.getWriter();
    response.addHeader("Refresh", "1");
    pw.println(new Date().toString());
    }
    }

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Update time with Servlet

    Hi, I don't know exactly what can be used to update the date. But, you can use the Date class to solve this program. If you create the object of Date class and then converted that particular date object to string format then you can able to get the updated date ie. current date. So, just try to do this which will able to get the updated time with the servlet. And while doing this you need to call every time to this method which contains the date object. So, you will get the current date.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Update time with Servlet

    Hello, I am new in java programming and also wanted to know the solution about this particular question to improve my knowledge. If you get the solution regarding this then please reply with that particular example. I am waiting for the reply which will provide the solution regarding this. If you got the solution then give it to me also, so that I am able to know how to update time with servlet. When I am using java, for the same purpose, I use Date class. But I don't know in servlet what we use.

Similar Threads

  1. JSP and Servlet problem
    By Devabrata in forum Software Development
    Replies: 5
    Last Post: 21-07-2010, 12:12 AM
  2. Difference between Servlet & ASP
    By Owen Fernandes in forum Software Development
    Replies: 5
    Last Post: 05-02-2010, 10:53 AM
  3. What is Servlet container?
    By Sonam Goenka in forum Software Development
    Replies: 5
    Last Post: 05-02-2010, 08:13 AM
  4. after daylight savings time update, still wrong time
    By Spencer in forum Windows Update
    Replies: 6
    Last Post: 10-05-2009, 10:20 AM
  5. Date and Time Update Problems
    By Russyan in forum Windows XP Support
    Replies: 2
    Last Post: 19-04-2007, 09:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,115,372.71427 seconds with 16 queries