Martin Eberle wrote:
> That's the way I do, BUT I've more than one servlet, which needs the
> query-resulted data!
> - So more servlets simultaneous share the same data objects
>
> 1. More servlets share same data
> 2. Data are holded in more than one object (?? synchronization ??)
>
> Ecommerce:
> 1. Search data (servlet)
> 2. Navigate through data (servlet)
> 3. Show products in the shopping-basket (servlet)
>
> Is that a resolveable situation?
> Martin
>
The simplest way to deal with these types of issues is to store your data in an
HttpSession associated with the current user. That way, all servlets (or JSP
pages, or whatever) accessed as part of the session have access to the
information, and you only need to store it once, which saves memory and solves
any concern about synchronization (i.e. there is only one copy of the object,
instead of one per servlet).
Look up javax.servlet.http.HttpSession in the servlet API docs, and in particular
check out the putValue(), getValue(), and removeValue() methods. You can store
any Java object you want into a session.
Craig McClanahan
___________________________________________________________________________
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