• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Timing the Call to a Servlet or Jsp.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In the form tag of html we have the action attribute, where we specify the resource to be invoked, when we submit the form.

And generally we supply a Servlet or Jsp here.

And when we click submit button the request will be sent to the server, where the corresponding servlet object is created.

My requiement is to time the Call to a servlet or jsp such that it should be called only after a specific period of time.

Say for example 15 seconds or 20 seconds etc.

Can anyone plz help out.

Thanks in advance.
Kris.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would need to use client side Javascript to do this.
Search for "onSubmit" and "setTimeout" in either the HTML/Javascript forum on this site or on Google.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by gadipe kris:
Hi,

In the form tag of html we have the action attribute, where we specify the resource to be invoked, when we submit the form.

And generally we supply a Servlet or Jsp here.

And when we click submit button the request will be sent to the server, where the corresponding servlet object is created.

My requiement is to time the Call to a servlet or jsp such that it should be called only after a specific period of time.

Say for example 15 seconds or 20 seconds etc.

Can anyone plz help out.

Thanks in advance.
Kris.



********************************

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class ClientPull extends HttpServlet {

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();

res.setHeader("Refresh", "10");
out.println(new Date().toString());
}
}

try this.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code would suggest the the browser refresh itself after 10 seconds.
The requirement that the original poster described was for the page not to submit for n seconds.
 
I didn't say it. I'm just telling you what this tiny ad said.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic