Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing scoped variables using EL

 
Vinod Awar
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hii ranchers,

Iam learning EL.iam trying my hand at some sample code.In servlet iam setting attributes in different scopes. and then in a jsp page i try to access these attributes using EL.Here is my servlet code


and jsp page

now how can i access all values of the attribute repeated.


Thanks,
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can access the different scopes via the following implicit objects:
pageScope, requestScope, sessionScope, applicationScope.

 
Vinod Awar
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Satou kurinosuke


I tried that and it works. But does that mean web designers are supposed to know the scope of attributes they are trying to access.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better say that you usually put a variable in only one scope, to avoid troubles. Putting the same variable in different scope is asking for troubles
 
Vinod Awar
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic