title: How to refresh a table without creating a separate jsp?
body: <p>I have a table and one search fields, based on what is entered in the search fields the contents of the table are refreshed and if nothing is entered in the search fields the full table is loaded. Here when the user clicks on Go button the ajax call is made.</p>
  
  <p>Currently, I have two jsp as below:</p>
  
  <p><strong>MAIN JSP</strong></p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
          $(document).ready(function() {
           $( "#go-user" ).click(function() {
  
                   var userId =  $('#usrId').val();
                   alert(userId);
  
                   $.ajax({
                         url: 'popUserSelect', // action to be perform
                         type: 'POST',       //type of posting the data
                         data: { userId: userId }, // data to set to Action Class
                         dataType: 'html',
                         success: function (html) {
                           alert(html);  
                           $('#load-user').html(html);
                           //document.getElementById("leftDiv").innerHTML=html; //set result.jsp output to leftDiv 
                         },
                         error: function(xhr, ajaxOptions, thrownError){
                            alert('An error occurred! ' + thrownError);
                         }
  
                      });
                   return false;
              });
          });
      &lt;/script&gt;
      &lt;s:form theme="simple"&gt;
      User Id  : &lt;s:textfield name="userId"  id="usrId"  theme="simple"/&gt;
      &lt;s:submit action="popUserSelect" key="Go"&gt;&lt;/s:submit&gt;
      &lt;/s:form&gt;
  &lt;div id="load-user"&gt;    
      &lt;table width="100%"&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;Select&lt;/th&gt;
                  &lt;th&gt;ID&lt;/th&gt;
                  &lt;th&gt;Name&lt;/th&gt;
                  &lt;th&gt;Role&lt;/th&gt;
                  &lt;th&gt;Location&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
          &lt;s:iterator value="userSupList" &gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;input type="radio"  class="RadioButton" name="userRadio" value='&lt;s:property value="USR_AMLUSERNAME"/&gt;' /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;s:property value="USR_AMLUSRID"/&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;s:property value="USR_AMLUSERNAME"/&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;s:property value="USR_ROLEID"/&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;s:property value="USR_LOCATIONID"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/s:iterator&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
   &lt;/div&gt;   
      &lt;input type="button" value="Submit" onclick="buttonClick('SubmitUser')"/&gt;
      &lt;input type="button" value="Cancel"  onclick="buttonClick('Close')"/&gt;      
  </code></pre>
  
  <p><strong>Refresh Jsp:</strong></p>
  
  <pre><code> &lt;table width="100%"&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Select&lt;/th&gt;
                      &lt;th&gt;ID&lt;/th&gt;
                      &lt;th&gt;Name&lt;/th&gt;
                      &lt;th&gt;Role&lt;/th&gt;
                      &lt;th&gt;Location&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
              &lt;s:iterator value="userSupList" &gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;input type="radio"  class="RadioButton" name="userRadio" value='&lt;s:property value="USR_AMLUSERNAME"/&gt;' /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;s:property value="USR_AMLUSRID"/&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;s:property value="USR_AMLUSERNAME"/&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;s:property value="USR_ROLEID"/&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;s:property value="USR_LOCATIONID"/&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/s:iterator&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
  </code></pre>
  
  <p>Is there any way that I can avoid using two jsp for refreshing and refresh the jsp on the same main jsp itself? </p>