title: How to access variable names dyamically in jstl
body: <p>I am new to jsp and jstl and this may not be exactly possible. I need a way to display multiple shipments based on an order. In later pages I would like to be able to pass a variable to select which shipment information to display.</p>
  
  <p>currently my variables are created like this:</p>
  
  <pre><code>&lt;c:choose&gt;
      &lt;c:when test="${param.order == 1}"&gt;
          Param.o_num = &lt;c:out value="${param.order}"/&gt;
  
  
          &lt;c:set var="o_buyer" value="Michael S" /&gt;
          &lt;c:set var="o_address" value="1234 Frederick St" /&gt;
          &lt;c:set var="o_cost" value="$99.98" /&gt;
          &lt;c:set var="o_number" value="0000646ASDF" /&gt;
  
          &lt;c:set var="o_shipments" value="3" /&gt;
  
          &lt;c:set var="sh_1_to" value="Colonel Mustard" /&gt;
          &lt;c:set var="sh_1_date" value="Wednesday, May 10, 2017" /&gt;
          &lt;c:set var="sh_1_address" value="1234 Study Lane" /&gt;
          &lt;c:set var="sh_1_city" value="Omaha" /&gt;
          &lt;c:set var="sh_1_state" value="NE" /&gt;
          &lt;c:set var="sh_1_zip" value="68152" /&gt;
          &lt;c:set var="sh_1_num" value="001" /&gt;
          &lt;c:set var="sh_1_total" value="$24.99" /&gt;
          &lt;c:set var="sh_1_status" value="Preparing Shipment" /&gt;
          &lt;c:set var="sh_1_message" value="Its good stuff, please enjoy." /&gt;
          &lt;c:set var="sh_1_signature" value="- Michael" /&gt;
  
          &lt;c:set var="sh_2_to" value="Miss Scarlet" /&gt;
          &lt;c:set var="sh_2_date" value="Wednesday, April 24, 2017" /&gt;
          &lt;c:set var="sh_2_address" value="1234 Library Ave" /&gt;
          &lt;c:set var="sh_2_city" value="Omaha" /&gt;
          &lt;c:set var="sh_2_state" value="NE" /&gt;
          &lt;c:set var="sh_2_zip" value="68102" /&gt;
          &lt;c:set var="sh_2_num" value="002" /&gt;
          &lt;c:set var="sh_2_total" value="$24.99" /&gt;
          &lt;c:set var="sh_2_status" value="Preparing Shipment" /&gt;
          &lt;c:set var="sh_2_message" value="Eat Well and Prosper." /&gt;
          &lt;c:set var="sh_2_signature" value="- Mike S" /&gt;
  
          &lt;c:set var="sh_3_to" value="Mrs Peacock" /&gt;
          &lt;c:set var="sh_3_date" value="Wednesday, April 18, 2017" /&gt;
          &lt;c:set var="sh_3_address" value="1234 Kitchen Blvd" /&gt;
          &lt;c:set var="sh_3_city" value="Omaha" /&gt;
          &lt;c:set var="sh_3_state" value="NE" /&gt;
          &lt;c:set var="sh_3_zip" value="68106" /&gt;
          &lt;c:set var="sh_3_num" value="003" /&gt;
          &lt;c:set var="sh_3_total" value="$24.99" /&gt;
          &lt;c:set var="sh_3_status" value="Delivered" /&gt;
          &lt;c:set var="sh_3_message" value="Don''t forget to chew." /&gt;
          &lt;c:set var="sh_3_signature" value="- Michael S" /&gt;
  
  
  
      &lt;/c:when&gt;
      &lt;c:when test="${param.order == 2}"&gt;...
  </code></pre>
  
  <p>and i access them by like:</p>
  
  <pre><code>&lt;c:choose&gt;
      &lt;c:when test="${not empty sh_1_to }"&gt;
  
          &lt;div class="border"&gt;
              &lt;a class="os_card &lt;c:out value=" ${sh_1_status= ='Delivered' ? 'os_card_disabled' : '' }" /&gt;" title="" href="${shipURL}1"&gt;
                  &lt;dl class="os_shipment"&gt;
                      &lt;dt&gt;Send To&lt;/dt&gt;
                      &lt;dd&gt;${sh_1_to}&lt;/dd&gt;
  
                      &lt;dt&gt;Est. Delivery&lt;/dt&gt;
                      &lt;dd&gt;${sh_1_date}&lt;/dd&gt;
  
                      &lt;dt&gt;Total&lt;/dt&gt;
                      &lt;dd&gt;${sh_1_total}&lt;/dd&gt;
  
                      &lt;dt&gt;Number&lt;/dt&gt;
                      &lt;dd&gt;${o_number}-${sh_1_num}&lt;/dd&gt;
  
                      &lt;dt&gt;Status&lt;/dt&gt;
                      &lt;dd&gt;${sh_1_status}&lt;/dd&gt;
  
                  &lt;/dl&gt;
              &lt;/a&gt; 
          &lt;/div&gt;
  
      &lt;/c:when&gt;
      &lt;c:otherwise&gt;
      &lt;/c:otherwise&gt;
  &lt;/c:choose&gt;
  </code></pre>
  
  <p>is there a way for me to change it to ${shipment.to} where 'shipment' is a variable?</p>