Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

sharing attributes/datas between servlets  RSS feed

 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For sharing an attribute/data across multiple servlet, we can attach that attribute with ServletRequest object, HttpSession object, and ServletContext object. this OK to me, but why can't we use ServletResponse object to attach those object/attributes?

Will it expired? I know ServletRequest object and ServletResponse object have the same scope, then?

Thanks...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the API docs for HttpServletResponse? (Note that this is a link.) What method(s) would you use to store arbitrary data to send back to a browser (or another servlet, if you're dead-set on the maintenance nightmare that is servlet chaining)?
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's fine, I got it from a previous post. have a look it here
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:What method(s) would you use to store arbitrary data to send back to a browser (or another servlet, if you're dead-set on the maintenance nightmare that is servlet chaining)?


I should do this before! (Check the API) Thanks David Newton, there is no setter method to attach attributes on ServletResponse object.

Thanks!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!