Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Variable and JSTL  RSS feed

 
Saurabh Pillai
Ranch Hand
Posts: 529
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am accessing a session variable in JSP page using JSTL in following way.

Here I have hard coded the session variable name, i.e. 'user'. And I don't want to hard code it. Is there any other efficient workaround?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the scoped variable name is stored in another scoped variable, let's say xyz, then:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!