The reference to "response.getWriter" will be invalid once the response is
sent back and I don't think it waits for the other threads to stop.It's not
possible to send updates through a thread like this.(if it was so easy
,people wouldn't have struggled for server push).If you want server push,you
can't close the outputstream.
> -----Original Message-----
> From: Rakesh Bhat [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, July 03, 2000 10:37 PM
> To: [EMAIL PROTECTED]
> Subject: jsp and Thread
>
> Hi,
>
> is it possible to call a threads directly from a jsp page ?
> can a bean be a thread by itself ?
>
> Pls look at the following code and tell me what is wrong ?
>
> right.jsp
>
>
> <%@ page autoFlush="true" import = "ReadMessages"%>
> <jsp:useBean id="mb" class="oracle.mailClient.ReadMessages"
> scope="application"/>
>
> <%
> PrintWriter writer= response.getWriter();
> mb.setParameter(writer);
> mb.start();
> %>
>
>
> ReadMessage.java (is a bean)
>
> class ReadMessage extends Thread
> {
>
> private PrintWriter w;
>
> public void run()
> {
>
> showMessage();
> }
>
> public void setParameter(PrintWriter w)
> {
> this.w=w;
> }
>
> public void showMessage()
> {
> w.println("Hi Everybody........");
> }
>
> }
>
>
> Problem is , thread is running but the message is not displayed on the
> page :( why is this ?
> Where i am going wrong ?
>
> I am using TOMCAT to run.
>
>
> Thanx in advance
> Rakesh.
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets