tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodrigo Ruiz <>
Subject Re: where should i store a attribute
Date Fri, 31 Oct 2003 12:44:15 GMT
Edson Alves Pereira wrote:

>	Hello folks, i´m trying to store a database connection in a session
>attribute or request attribute, but i must choose a name that just one
>thread per time would knowns. Any idea?
If you put the attribute in your request, the name does not matter: only 
forwarded or included servlets / JSPs will have access to the object, 
even if the same name is always used.
If you want each request to use a different instance of an object, 
request attributes are the correct place. Session attributes are best 
fitted for instances that must be shared among multiple requests from 
the same user (well, exactly from the same user session ;-).

Anyway, consider also to execute your DB queries internally and put as 
attribute the results instead of the connection. It is usually better :-)

>	Regards,
>	Edson

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message