aspose file tools*
The moose likes Servlets and the fly likes persistent servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "persistent servlet" Watch "persistent servlet" New topic
Author

persistent servlet

vishvar hariraman
Greenhorn

Joined: Apr 04, 2006
Posts: 20
Hi everybody

I know servlets are persistent.
It retains some data in its memory,so it avoids frequent disk access against the database.
Which is the memory of servlet? ie. how servlets are persistent?
Because of using session variables?

PLS FRIENDS CLARIFY TO ME

THX
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I'm not sure I understand your question correctly, but servlets are not persistent, they should be 'effectively stateless', that is any state they require internally should be treated as a constant and not be able to change, and idealy this state would be set on the ServletContext and not the Servlet itself.
vishvar hariraman
Greenhorn

Joined: Apr 04, 2006
Posts: 20
yes,ofcourse.
Using ServletContext,servlet can retain a constant value and share it with other servlets also.
then we can say it as persistent
but u say it s not.what s the reason for that?
which thing we shud say as persistent? Connecting to database only?
pls clarify.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

As I said, the servlet does not retain any state itself, it allows any state it requires to be retained elsewhere, outside the servlet itself. Likewise, the servlet should not (or in this case must not) maintain state such as Database connections. In the case of DB connections it is dangerous and wasteful, and Connection Brokers do the job much beter.

Dave
vishvar hariraman
Greenhorn

Joined: Apr 04, 2006
Posts: 20
thx david
i got
------Vishnuvardhan.H
 
jQuery in Action, 2nd edition
 
subject: persistent servlet