tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Viehl Clemens <c.vi...@syborg.de>
Subject RE: Expert advice needed
Date Tue, 09 May 2000 12:27:43 GMT
> > I was thinking of converting my application to a servlet, 
> and using an
> > applet in a browser to control it, but I can't see how to 
> get an applet to
> > provide ongoing communication with a servlet.  

This is possible and there are several articles on the web or books (Jason
Hunter) with examples. Also there was some mails in this list a few days
before with applet-servlet - communication.
(The only URL i've found in my bookmarks:
http://www.j-nine.com/pubs/applet2servlet/Applet2Servlet.html )


>All the 
> examples I have seen
> > show servlets basically returning HTML back to the browser 
> as a one-off
> > process.

Servlets are usually called per HTTP-Gets or post, and often return HTML.
But they don't need to. They can return everything you can send through
HTTP, examples are XML, HTML, GIF, JPEG, Serialised Java Objects ...

You say servlets work as
> as a one-off
> > process.

I'm not sure how you mean this (my english is too bad :(, but servlets work
as follow:
They (the Servlet-Object) get instantiated when the servlet container gets
the first request for this servlet, OR you say your Servlet Container that
he should init this servlet on startup.
Then this object sits and waits for new requests.
The servlet can get data from the request and send data back to the client.

> Not only do servlets persist between requests, but so do any threads
> created by servlets. This perhaps isn't useful for the run-of-the-mill
> servlet, but opens up some interesting possibilities. Consider the
> situation where one background thread performs some calculation while
> other threads display the latest results. It's quite similar to an
> animation applet where one thread changes the picture and another one
> paints the display.
> 
> I've never tested this myself, and don't know if Tomcat 
> conforms to it's
> principle, but it may be a start point.

This works with tomcat. You can do all things, normal Java-applications can
do, but your servlets itself gets started with a request and then it
performs its service Method.

Regards 

Clemens Viehl

Mime
View raw message