>Sounds like you're calling the thread from the init() method of the
servlet.
>This is only called once when the servlet is loaded by the web
server. If
>the web server keeps the servlet in memory it will not be called
again. If
>you want the thread to run every time the servlet receives a request,
you
>should put it in the doGet() or doPost() methods instead.
>
>
>>>   within a servlet how do i redirect user to a html page and for
every
>>> 10 seconds the servlet will reload the page meaning that there
will be
>>> a loop within the servlet. my point here is to allow the servlet
to
>>> get new values from a file (the values inside the file will be
changed
>>> frequently) and display it to the same window everytime with
updated
>>> values.
>
>If you want the page on the server to be updated so that the client
always
>gets the latest version, the you could start a new thread in the
servlet's
>init() routine which updates the HTML page every 10 seconds. That way
the
>client will always get the latest version.
>
>However, if you want the client's page to be automatically refreshed
every
>10 seconds, so that they can sit back and watch the values changes,
to the
>best of my knowledge, you can't make a servlet do it. What you *can*
do,
>which has the same effect is include the following HTML META TAG in
the
>page...
>
><META HTTP-EQUIV="Refresh" CONTENT="10">
>
>This will cause the *browser* to refresh the page every 10 seconds.
The
>servlet can then provide the latest version on each request.
>
>
>One last point...
>>>   i would like to call a another servlet from within a servlet and
>>> passing in valueS to the other servlet into doGet(). how do i do
>>> that?....would you tell me in details please.
>>
>>You can call another servlet from a servlet by getting the handle to
the
>>other servlet like below:
>>>From BServlet's doGet(req,res) or doPost(req,res) you can call
AServlet's
>>doGet() or doPost() or any public methods.
>>
>>       AServlet login=
>>
>(AServlet)getServletConfig().getServletContext().getServlet("AServlet
");
>>                if(login != null)
>>                        login.doGet(req,res);
>>
>>
>>This method is possible if both the servlets are in the same server.
>>
>>if they are in different servers then use oreilly's class
HttpMessage
>>class to pass values. (www.oreilly.com).
>>
>>
>
Hi there Tom,

thanks for answering my question.
i have tried to use the portion of code that u supplied but it doesn't
compiled. the compilation error stated that:
The method javax.servlet.Servlet
getServletConfig().getServletContext() has been deprecated.
i tried to find a fix for this deprecation but there is no example in
the doc. can u please help me to fix it.

thanks a lot.
please reply asap.

regards,
alex

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to