title: Refresh <s:select> tag on changing backing Java collection in Struts 2
body: <p>I am using two <code>&lt;s:select&gt;</code> tags and a Java collection <code>List</code> is in its list attribute.</p>
  <p>On change of the one I want to populate a second dropdown. I've used jQuery for that, it's called an action bean and populated the list with JSON response when it was returned and then set the values in the second drop down. All is working fine. JQuery code is shown below.</p>
  
  <pre class="lang-js prettyprint-override"><code>$(document).ready(function () {
      $('#projectNameBox').change(function (event) {
          var projectNameBoxVal = $(&quot;select#projectNameBox&quot;).val();
          alert(projectNameBoxVal);
          $.getJSON('getPackageListAction.action', {
              &quot;projectId&quot;: projectNameBoxVal
          }, function (jsonResponse) {
              alert(jsonResponse);
              var packageNameSelectBox = $('#packageNameBox');
              packageNameSelectBox.find('option').remove();
              $.each(jsonResponse, function (key, value) {
                  $('&lt;option&gt;').val(key).text(value).appendTo(packageNameSelectBox);
              });
          });
      });
  });
  </code></pre>
  <p>Now my concern is when I updated the second backing list by calling action on change of the first, then why I have to use below code to set option data?</p>
  <pre class="lang-js prettyprint-override"><code>var packageNameSelectBox = $('#packageNameBox');
  packageNameSelectBox.find('option').remove();
  $.each(jsonResponse, function (key, value) {
      $('&lt;option&gt;').val(key).text(value).appendTo(packageNameSelectBox);
  });
  </code></pre>
  <p>Can we just refresh the component to reflect changes of backing list ?</p>