title: How to use a Java class variable in a JSP
body: <p>I am using Struts2 and I need to access the Java class variable on the JSP page. How can I do it? In the Java variable I have appended script and HTML. I need to render that HTML and scripts. In <code>textField</code> I can easily access the variable <code>commonString</code>. But I'm unable to render it as HTML.</p>
  
  <p>Variable in java page:</p>
  
  <pre><code> StringBuilder data=new StringBuilder().append("&lt;script type=\"text/javascript\"       src=\"").append("js/crossfilter.v1.js").append("\"&gt;&lt;/script&gt;");
           data.append("js/bubble.js").append("\"&gt;&lt;/script&gt;").append("&lt;body onload='bubble").append("&lt;%=request.getAttribute("+commonString+")%&gt;)").append("'&gt;").append("&lt;/body&gt;");
           String commonString=data.toString();
  </code></pre>
  
  <p>HTML page:</p>
  
  <pre><code>&lt;%@ taglib prefix="s" uri="/struts-tags"%&gt;
  &lt;%@ page import="com.helical.efw.view.StageExecution" %&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" 
   prefix="c" %&gt;
   &lt;html&gt;
     &lt;head&gt;
     &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
     &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;
      &lt;/script&gt;
      &lt;title&gt;Insert title here&lt;/title&gt;
      &lt;style&gt;
  
           text {
       font: 10px sans-serif;
        }
        &lt;/style&gt;
          &lt;%!
           String ss;
         %&gt;
         &lt;/head&gt;
       &lt;s:textfield name="commonString" value="%{commonString}"&gt;&lt;/s:textfield&gt;
       &lt;/html&gt;
  </code></pre>