Reputation: 9611
I am a bit unclear, it seems request.getAttribute (or setAttribute) is for application scope i.e. shared accross all servlets in the application.
Is there something that I can get/set on a per request (not session, but per web request) scope?
Example, in a filter, I may want to add something for this request only that I get then retrieve in my servlet's doGet.
Upvotes: 0
Views: 1366
Reputation: 3509
"Application scope" mean normal java object and classes. Use static fields, singletons, e.t.c
Upvotes: 0
Reputation: 1108642
it seems request.getAttribute (or setAttribute) is for application scope i.e. shared accross all servlets in the application.
This is not true. This is only applicable to those methods on ServletContext
. You're apparently mixing it with HttpServletRequest
or misinterpreting the concrete problem you're currently facing, but didn't tell anything about in your question. The HttpServletRequest
instance and all of its attributes is definitely request scoped.
Upvotes: 3