• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Access session variable in JavaScript

 
Varsha Garud
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same here i want to access a session variable in javascript..
in java i can access it by getServletContext().getInitParameter("DATE_FORMAT") (where DATE_FORMAT is my session variable)
I want to access this varaible in javascript..How to do that??
Might be a lame question but need help..
Thank you in advance [/color]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. Not directly.

What you can do to is to create JavaScript markup that assign the value to a JavaScript variable. As in:
assuming that the value is a String.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic