title: How to show javascript alert with string val in jsp
body: <p>I am trying to show an alert in my jsp page with the following code.</p>
  
  <pre><code>&lt;%
  ---------------
  ---------------
  out.write("&lt;script type='text/javascript'&gt;\n");
  out.write("alert('Hello')");
  out.write("&lt;/script&gt;\n");
  ---------------
  ---------------
  %&gt;
  </code></pre>
  
  <p>Everything is working fine. Alert is coming when page is loading.
  Now  I want to show an alert with string variable. For this I changed the above code to below. Now  the alert is not coming.</p>
  
  <pre><code>&lt;%
  ---------------
  ---------------
  String name = (String) application.getAttribute("name");
  System.out.println("name = "+name);
  out.write("&lt;script type='text/javascript'&gt;\n");
  out.write("alert('Hello'+name)");
  out.write("&lt;/script&gt;\n");
  ---------------
  ---------------
  %&gt;
  </code></pre>
  
  <p>Could you please tell me how to add string variable to the above alert function.</p>