This is a fairly major part of using servlets - session tracking. Check out
the HttpSession class, which allows you to store objects which relate (via
the SessionId) to individual users. This requires that users either allow
cookies, or on URL rewriting.

I'd put some example code but like I say it's a major part and worth reading
up on properly.

Simon

ASC wrote:

> A few days ago I asked in this list about using JavaMail or sun smtp
> classes. I have decided to use JavaMail classes. (for the only reason
> that I already have the jars ,and it is not so complicated as it seemed
> - to me, at least). Thanks to all that made their comments.
> Now I need a solution for the problem of mail. The idea is simple: the
> user requests certain information to a servlet, which retrieves it from
> a DB. I want the user can obtain a plain text file with the results of
> the query, if he/she wants. (pressing a button,i.e.) The results are
> also diplayed in the page returned by the servlet. A solution is to make
> a call to a different servlet that performs the same query, but doesn't
> return a page, but sends a mail. But it requires the query be performed
> twice. I would like to mantain in memory the string (really big string)
> in the servlet, and depending on the action required, the results are
> sent to a writer (browser) or sent via mail, so when the user clicks the
> button the same servlet uses the same string. But the problem is that if
> I mantain the variable (not declaring it in the service method), can
> occur several requests from different users, so the results arn't the
> same.
> To sum up, I would like receiving some suggestions on how "remember" the
> results beetwen two requests from the same user (without write to disk),
> or some way to not use two servlet that meke the same.
>
> Thanks.

___________________________________________________________________________
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

Reply via email to