• Post Reply Bookmark Topic Watch Topic
  • New Topic

Timing the Call to a Servlet or Jsp.  RSS feed

 
gadipe kris
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
ramakrish nan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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 Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!