Results 1 to 4 of 4
  1. #1
    BigBear is offline Member
    Join Date
    Jan 2010
    Posts
    37
    Rep Power
    0

    Default how to countdown on server side

    Hi everybody, I need following:
    1) browser visits my page
    2) on the server side, countdown sets off with some identificator (session ID, IP address, ... - give me some hint please)
    3) after finishing countdown off my page is redirected on other page
    - and this have to work despite browser reloaded the page.
    help me please. Thank you.

  2. #2
    BigBear is offline Member
    Join Date
    Jan 2010
    Posts
    37
    Rep Power
    0

    Default

    I've searched by Internet and I've found java.util.Timer... it could help... I'll try it later.

  3. #3
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    You can create a Hits class that contains a hit counter. Store the Hits object in the Application object and update the counter each time your servlet is called. Your display JSP can read the Hits object and display the counter value.

    The problem is that the counter will reset every time the Web application is restarted. If you want to keep a permanent record, you will have to the value in the Hits object in a database or as text in a file.

  4. #4
    BigBear is offline Member
    Join Date
    Jan 2010
    Posts
    37
    Rep Power
    0

    Default

    Hi all again, there is something new I need about countdown. Some modifications in my scenario. Now I need following:
    Java Code:
    public class Form extends HttpServlet {
        public void doPost(HttpServletRequest request, HttpServletResponse response)
                    throws ServletException, IOException {
            request.setCharacterEncoding("UTF-8");
            response.setContentType("text/html; charset=UTF-8");
            PrintWriter out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), "UTF8"), true);
    
            String html = "my-html-with-form";
            out.println(html);
    
            /********** I NEED FOLLOWING **********/
            String javascript = "script-that-send-my-html-form";
            // SOME CONSTRUCTION, WHICH WILL BE WAITING FOR SOME TIME (e.g. 30minutes)
            out.println(javascript);    // this line should send form, when time is passed
        }
    }
    Is here any way to make this construction? Which one? Help me, please. Thank you very much.

Similar Threads

  1. Replies: 1
    Last Post: 03-20-2010, 07:03 PM
  2. NIO Server: listening on client's side socket
    By carek in forum Networking
    Replies: 1
    Last Post: 12-24-2009, 07:30 AM
  3. updating server side file using java bean
    By tskarthic in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 04-30-2009, 02:53 PM
  4. How to open a file located in server from client side
    By Malathi in forum Web Frameworks
    Replies: 4
    Last Post: 04-20-2009, 09:10 PM
  5. Need to change cursor to hourglass at server side
    By bgupta in forum Java Servlet
    Replies: 0
    Last Post: 02-16-2009, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •