title: Velocity (VM) template request parameters: Getting GET variables
body: <p>How do i access GET variables as passed in the URI in a VM template?</p>
  
  <p>This works only when loading the widget URL:</p>
  
  
  
  <pre class="lang-jsp prettyprint-override"><code>$request.get("parameters").get("fav").get(0)
  </code></pre>
  
  <p>I'm looking for a neat solution that works with friendly URLs.</p>
  
  <p>Here's my testing template:</p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;br&gt;&lt;br&gt;&lt;br&gt;
  #set($url = $request.attributes.CURRENT_URL)
  
  &lt;h2&gt;url: $url&lt;/h2&gt;
  
  #set($favs = $url.split("fav="))
  favs: $favs&lt;br&gt;
  favs.size(): $favs.size() &lt;br&gt;
  #if($favs.size() &gt; 1)
    #set($fav1 = $favs.get(1).split("&amp;").get(0))
    fav1: $fav1&lt;br&gt;
  #else
    No fav!
  #end
  #if($favs.size() &gt; 2)
    #set($fav2 = $favs.get(2).split("&amp;").get(0))
    fav2: $fav2&lt;br&gt;
  #end
  
  #set($favs2 = $httpUtil.getParameterMap($url, "fav"))
  favs2: $favs2
  
  &lt;hr&gt;
  &lt;h3&gt;Fav?&lt;/h3&gt;
  &lt;form method="get"&gt;
    &lt;input type="checkbox" name="fav" value="dave"/&gt; Dave&lt;br&gt;
    &lt;input type="checkbox" name="fav" value="nate"/&gt; Nate&lt;br&gt;
    &lt;input type="checkbox" name="fav" value="taylor"/&gt; Taylor&lt;br&gt;
    &lt;input type="submit" value="Send"/&gt;
  &lt;/form&gt;
  &lt;hr&gt;
  &lt;div style="font-size: 9px;"&gt;request: $request&lt;/div&gt;
  </code></pre>