You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Luis Andrei Cobo <va...@yahoo.com> on 2000/05/10 03:31:41 UTC

REPOST: Multi-Threaded JSP??

Does anyone know any examples of the feasibility of using Threads on JSP pages or in Servlets? Im trying to do something with these pages Im building which require a large amount of processing that would be very efficient of broken down into Threads on a variety of levels. Has anyone used java.lang.Thread in thier JSP? gotten it to work?

If so, examples would be helpful. Im assuming for now that its not a high demand topic since it probably involves hand coding some of the _JSPservice directly, perhaps in order to implement the runnable interface or something.


Also, by extension, if it IS possible, can RMI and Applet Servlet communication be managed with a Thread?

Documentation anywhere on this?

Luis Andrei Cobo
Web Developer

Sorry about the post yesterday...i was writing a draft and accidentally sent it.

Re: REPOST: Multi-Threaded JSP??

Posted by gtallen <gt...@home.com>.
You might take a look at JSP tag libraries which allow you to
write custom tags (http://www.taglib.com), pretty cool!

> Luis Andrei Cobo wrote:
> 
> Does anyone know any examples of the feasibility of using Threads on
> JSP pages or in Servlets? Im trying to do something with these pages
> Im building which require a large amount of processing that would be
> very efficient of broken down into Threads on a variety of levels. Has
> anyone used java.lang.Thread in thier JSP? gotten it to work?
> If so, examples would be helpful. Im assuming for now that its not a
> high demand topic since it probably involves hand coding some of the
> _JSPservice directly, perhaps in order to implement the runnable
> interface or something.
> 
> 
> Also, by extension, if it IS possible, can RMI and Applet Servlet
> communication be managed with a Thread?
> 
> Documentation anywhere on this?
> 
> Luis Andrei Cobo
> Web Developer
> 
> Sorry about the post yesterday...i was writing a draft and
> accidentally sent it.

Re: REPOST: Multi-Threaded JSP??

Posted by Bruno Salgueiro <bs...@sibs.pt>.
Or you could use a Bean to do your multi-threaded processing.
This way, the page doesn't need to know or implement the Runtime inter-
face, only the Bean does. As a Java class can implement as many interfa-
ces as one wants, you can easily do that even if your Bean needs to
implement some more interfaces.

With servlets it's easier, following the general methodology to imple-
ment Threads.

Hope this helps

> Rob Parker wrote:
> 
> I'm a little puzzled by your request - but I'll try to put forward
> some points...
> 
> In general JSP's/Servlets provide small concise services, eg display
> content x, handle form y. Hence in most cases
> you don't need to handle the request using multiple threads. However
> within each JSP/servlet, the code needs to be thread
> safe because the page may need to handle concurrent requests. There is
> an architectural pattern based on the Model View Controller
> pattern which basically uses JSP's for the view and servlets for the
> controller. Hence since the JSP is only responsible for the
> view, it rarely needs some multithreaded processing pipeline.
> 
> On the other hand, if you were writing a chat server using a servlet,
> then you would probably want to use a multithreaded
> processing pipeline, eg, a background thread to dispatch incoming
> messages etc.
> 
> Thus I'd recommend looking at Sun's java website for more info on
> JSP's and the MVC architecture and www.servlets.com
> for more info on backgound threads in servlets.
> 
> regards
> 
> Rob
> 
>      ----- Original Message -----
>      From: Luis Andrei Cobo
>      To: tomcat-user@jakarta.apache.org
>      Sent: Wednesday, May 10, 2000 11:31 AM
>      Subject: REPOST: Multi-Threaded JSP??
> 
>      Does anyone know any examples of the feasibility of using
>      Threads on JSP pages or in Servlets? Im trying to do
>      something with these pages Im building which require a large
>      amount of processing that would be very efficient of broken
>      down into Threads on a variety of levels. Has anyone used
>      java.lang.Thread in thier JSP? gotten it to work?
>      If so, examples would be helpful. Im assuming for now that
>      its not a high demand topic since it probably involves hand
>      coding some of the _JSPservice directly, perhaps in order to
>      implement the runnable interface or something.
> 
> 
>      Also, by extension, if it IS possible, can RMI and Applet
>      Servlet communication be managed with a Thread?
> 
>      Documentation anywhere on this?
> 
>      Luis Andrei Cobo
>      Web Developer
> 
>      Sorry about the post yesterday...i was writing a draft and
>      accidentally sent it.

-- 
=======================================================
Bruno Salgueiro       (mailto:bs@sibs.pt)
                   
SIBS - Sociedade Interbancária de Serviços
Rua Soeiro Pereira Gomes, Lote 1, 1600 Lisboa, Portugal

Tel: + 351 21 791 88 33
Fax: + 351 21 794 24 40
http://www.sibs.pt

Esta mensagem foi assinada com certificado MULTIcert.
Para obter o certificado da Autoridade de Certificação
PILOTO MULTIcert dirija-se ao site
            http://www.sibs.multicert.com

"Computers are useless. They can only give you answers."
                                        --Pablo Picasso
=======================================================

Re: REPOST: Multi-Threaded JSP??

Posted by Rob Parker <ro...@webcybernetics.com>.
I'm a little puzzled by your request - but I'll try to put forward some points...

In general JSP's/Servlets provide small concise services, eg display content x, handle form y. Hence in most cases
you don't need to handle the request using multiple threads. However within each JSP/servlet, the code needs to be thread
safe because the page may need to handle concurrent requests. There is an architectural pattern based on the Model View Controller
pattern which basically uses JSP's for the view and servlets for the controller. Hence since the JSP is only responsible for the
view, it rarely needs some multithreaded processing pipeline.

On the other hand, if you were writing a chat server using a servlet, then you would probably want to use a multithreaded
processing pipeline, eg, a background thread to dispatch incoming messages etc.

Thus I'd recommend looking at Sun's java website for more info on JSP's and the MVC architecture and www.servlets.com
for more info on backgound threads in servlets.

regards

Rob
  ----- Original Message ----- 
  From: Luis Andrei Cobo 
  To: tomcat-user@jakarta.apache.org 
  Sent: Wednesday, May 10, 2000 11:31 AM
  Subject: REPOST: Multi-Threaded JSP??


  Does anyone know any examples of the feasibility of using Threads on JSP pages or in Servlets? Im trying to do something with these pages Im building which require a large amount of processing that would be very efficient of broken down into Threads on a variety of levels. Has anyone used java.lang.Thread in thier JSP? gotten it to work?

  If so, examples would be helpful. Im assuming for now that its not a high demand topic since it probably involves hand coding some of the _JSPservice directly, perhaps in order to implement the runnable interface or something.
   

  Also, by extension, if it IS possible, can RMI and Applet Servlet communication be managed with a Thread?

  Documentation anywhere on this?

  Luis Andrei Cobo
  Web Developer

  Sorry about the post yesterday...i was writing a draft and accidentally sent it.