title: setting a variable in JSP and using it in jquery
body: <p>I have a route object. It contains arrayList of options. I want to know the size of options and store it in some variable. (This thing needs to be done in JSP). I then want to access this variable in jquery. How to do it?</p>
  
  <p>JSP code :</p>
  
  <pre><code>&lt;%!int loopSize = routes.get(0).getOptions().size(); %&gt;
    &lt;c:forEach var="route" items="${routes}" varStatus="loopCounter"&gt;
      &lt;c:forEach var="option" items="${route.options}" 
                 varStatus="loopCounter2"&gt;
      &lt;---more code --&gt;
      &lt;/c:forEach&gt; 
    &lt;/c:forEach&gt;
  </code></pre>
  
  <p>But it is saying routes undefined. I am using struts2 and action class. Routes is coming from the action class</p>