title: Read session variable in javascript?
body: <p>I am setting session variable in servlet and want to access that variable in javascript.</p>
  
  <pre><code> ps = con.prepareStatement("select * from USERDETAILS where username=? and password=?");
   ps.setString(1, username);
   session.setAttribute("userName", username);
  </code></pre>
  
  <p>I tried these in javascript function. but it wasn't working...</p>
  
  <pre><code>var name = ${userName};
  var name = '&lt;%= Session["userName"] %&gt;';
  </code></pre>