title: Populating more than one HTML statement from a Javascript change via Java
body: <p>Im trying to populate two separate HTML objects when a change occurs in my webpage - one a dropdown list and one a form. </p>
  
  <p>So in my JSP code I have this:</p>
  
  <pre><code>$('#uSystemList').change(function() {
      $.get("/live-application/systemById", {systemid: $("#uSystemList").val()}, displayChangedSystemResults, "html");
  });
  
  &lt;script type="text/javascript"&gt;
  function displayChangedSystemResults(html){
      $('#uList').empty();
      $('#uList').append(html);
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>And on the Java side I have this:</p>
  
  <pre><code>@RequestMapping(value = "/systemById", method = RequestMethod.GET)
  public void getSystemById(@RequestParam("systemid") String systemid, OutputStream outputStream) throws IOException {
      StringBuilder refreshHtml = new StringBuilder();
      try {
          String html = "";
          System system = service.getSystemById(systemid));
          for (Value value: inewsSystem.getValues()) {
              html = html + "&lt;option value='" + value.getId() + "'&gt; " + value.getName() + "&lt;/&gt;";
              }
          } 
          refreshHtml.append(html );
          outputStream.write(refreshHtml.toString().getBytes());
          outputStream.flush();
      } catch (Exception e) {
          outputStream.flush();
      }
  }
  </code></pre>
  
  <p>So that populates my <code>uList</code> dropdown - but how do I tell it to populate something else as well (e.g. a form, but could be anything else as an example...). The <code>OutputStream</code> seems to only let me populate one object per change.</p>