title: Pass variable from JSP to javascript file
body: <p>I have an int variable in that gets passed into a jsp file from a java class. I now want to pass this int value from the jsp to a javascript file I have. I am stuck with a coming up with a solution. I have tried the following but still does not work:</p>
  
  <p>javascript: </p>
  
  <pre><code>jQuery(document).ready(function() {
      jQuery('div.awsmp-hero-featureSwap').each(function() {
          jQuery(this).find('div.hero-featureSwap').each(function() {
              var width = 0;
              var height = 0;
              var count = 1;
              var perpage = "${products_per_page}"; //  ***** this is the value I want from the jsp*****
              var totalcarousel = jQuery('.hero').length;
              jQuery(this).find('div').each(function() {
                  width += jQuery(this).width();
                  count = count + 1;
                  if (jQuery(this).height() &gt; height) {
                      height = jQuery(this).height();
                  }
              });
  
              jQuery(this).width(((width / count) * perpage + 1) + (perpage * 12) + 60 + 'px');
              jQuery(this).height(height + 'px');
          });
      });
  </code></pre>
  
  <p>JSP:</p>
  
  <pre><code>    &lt;c:set var="products_per_page" value="3" /&gt;
      &lt;c:if test="${not null model.listSize}"&gt;
          &lt;c:set var="products_per_page" value="${model.listSize}" /&gt;
      &lt;/c:if&gt;
  </code></pre>
  
  <p>I just want to pass the the "products_per_page" value to the javascript. should be very simple...</p>