Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call pop up from servlet with timer

 
Ernesto Casillas
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I don't understand what you mean by that.
 
Mahendr Shinde
Ranch Hand
Posts: 38
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic