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

access session scope variables in jsp  RSS feed

 
paresh doshi
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an application in Springs.I have a variable set in the Map in my controller which is in session. I need to use that variable in my jsp using the jstl tags so that i can access it from session scope in multiple jsps.

Can anyone provide me the tag with syntax that can be used to achieve the required thing.

Thanks in advance.

Regards,
Paresh.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66143
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You reference any scoped variable, in the session or the other scopes, by simply naming it in an EL expression.

For example:
 
Srikanth Nutigattu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a small point to add for Bear statement,

I have a variable set in the Map in my controller which is in session. I need to use that variable in my jsp


As you have said the variable is in a Map which is in the session,

you need to access using ${mapName.keyName} or ${mapName["keyName"]}

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