Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp session scope List values

 
Mujahed Syed
Ranch Hand
Posts: 34
IntelliJ IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to save a ArrayList of values in sesssion scope. This is basically a Shopping cart which is storing all the items in basket. If I use the method request.setAttribute(String, Object) it will store my values in request scope. If I use session.setAttribute(String, Object) will my method have a global scope in the application? And will I be able to access this from any jsp/servlet pages?

Thanks
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Session is not global scope

Request, application or sessions are completely different types of scopes available in a web application.

When you ask for global, session is not global scope, it is per user (to be more specific, for one browser).

Yes, values in the session would be available in JSPs and access the same, but only for that user
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic