Hi Uddipan,
I'm afraid I have to disagree with your "SingleThreaded" solution.
AFAIK, that won't help much with his problem if he stills uses one query
shared by all users. The right way to do it is to store a query per user
and be able to identify in each request which user is performing the
query to direct him to his own result set or create one if needed. One
way of doing so is using sessions as someone suggested, even some
"hidden" parameters with a query identifier/actual row in the URLs of
the next/previous button might do as well.
The SingleThreadModel just helps you ensuring that the service method of
one of the instances of your servlet won't be used to serve concurrently
more than one request. This doesn't help you identifying the users and
it doesn't help you also when you access a shared resource(like the
result query in this case) as different servlet instances might get in
trouble when accessing this resource concurrently.
I hope this helps,
Dan
-------------------------------------------
Daniel Lopez Janariz ([EMAIL PROTECTED])
Web Services
Computer Center
Balearic Islands University
-------------------------------------------
Uddipan Bagchi wrote:
>
> > Can someone explain how the multiple (concurrent) requests are handled
> > by the Web-server/Servlet-engine with regards to Servlet/JSP/JavaBeans ?
>
> To save object creation time, the servlet engine creates the servlet class only
> ones, and doles out the same stuff to all requests that come in. Well, the above is
> almost correct... since (look down...)
>
> > I would obviously like each user to be able to make his own query and see
> > his private results.
> > If I run this Servlet from one browser and then from another (browser) on
> > different machine,
> > I see the same data that is being displayed to the first user. This shows
> > there is only one instance of Servlet object.
>
> You can have your servlet implement SingleThreadModel to force the engine to create
> a separate object for each request.
>
> >
> >
> > I have NOT used sessions. I believe Sessions are supposed to help here. But
> > how ?
>
> Yes. I think there's been a reply to this effect from somebody. This is the better
> approach for a high volume site. This does not require SingleThread-ing.
>
> > How does it work when I have JSP and JavaBeans ?
>
> To enable single threading, specify in the page directive isThreadSafe = "false"
>
> >
> > How many JavaBeans (objects) are created when I <jsp:useBean /> a JavaBean
> > at a Request/Session/Application scope ?
> >
>
> Depending upon the scope attribute.
>
> - Uddipan.
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html