title: Struts 2 - Pre-populate a form using the Object's Attributes
body: <p>I want to pre-populate a form using <code>Struts 2</code> tags with the values of attributes of the object that I have received from session.<br></p>
  
  <pre><code>PromoCode promoCode = (PromoCode) session.getAttribute("PROMOCODE");
  </code></pre>
  
  <p><br>
  I tried with this approach but it did not work.</p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;s:form action="add"&gt;
              &lt;s:select label="Ticket Name " name="ticketName" list="{'PARTY PLATINUM', 'INAUGURATION PREMIUM'}"&gt;&lt;/s:select&gt;
              &lt;s:textfield label="Promotion Type " value="%{promoCode.promotionType}" name="promotionType"&gt;&lt;/s:textfield&gt;
              &lt;s:select label="Discount Access " value="promoCode.discountAccess" name="discountAccess" list="{'Choose Your Discount Access', 'Coded Discount', 'Public Discount'}"&gt;&lt;/s:select&gt;
              &lt;s:textfield label="Name of the Public Discount " name="nameOfPublicDiscount"&gt;&lt;/s:textfield&gt;
              &lt;s:textfield label="Discount per ticket (%) " value="promoCode.discountPerTicket" name="discountPerTicket"&gt;&lt;/s:textfield&gt;
              &lt;s:textfield label="Uses per offer " value="promoCode.uses" name="uses"&gt;&lt;/s:textfield&gt;
              &lt;br/&gt;
              &lt;s:submit id="update" value="UPDATE"&gt;&lt;/s:submit&gt;
  &lt;/s:form&gt;
  </code></pre>
  
  <p><br>
  How to fix this ?</p>