aspose file tools*
The moose likes Servlets and the fly likes Call pop up from servlet with timer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Call pop up from servlet with timer" Watch "Call pop up from servlet with timer" New topic
Author

Call pop up from servlet with timer

Ernesto Casillas
Greenhorn

Joined: Apr 15, 2013
Posts: 2
Hi everybody, greetings from Mexico =D

I have a problem, I want to create a servlet that let me call a pop up windows as an alert in a web project, the intention is that at the moment when the user log in a timer starts and some time later execute the code that sends the alert. I tried the following but only runs as local, not on server:

First into doGet:




Then:






Sorry for may bad English, I hope somebody can help me =)
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18672
    
    8

That's right, nothing you run on the server can cause an alert message to pop up on the client's machine. So servlets are useless for this requirement. You'll have to do it with Javascript on the client.

Of course that Javascript might have to ask code on the server for help if there's more than one page view involved in this timer, but the actual alert message will have to be displayed by Javascript code.
Ernesto Casillas
Greenhorn

Joined: Apr 15, 2013
Posts: 2
Many thanks for the reply Paul, I have another question:

1. I've seen how can send java script to the client, the problem is when I try to use "HttpServletResponse" out of doGet or doPost method. Do you know how can I use it?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18672
    
    8

Sorry, I don't understand what you mean by that.
Mahendr Shinde
Ranch Hand

Joined: Sep 03, 2011
Posts: 38

Your HttpServletRequest and HttpServletResponse objects are created by ServletContainer as soon as you make a request.
don't try to use them outside your "service" methods (doGet or doPost).

There is still lot to learn!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Call pop up from servlet with timer