title: How to refresh the content of a JSP?
body: <p>I have a jsp page , on a button click I want to fetch values from bean and do some action  on the basis of that data.</p>
  <p>(This button is not posting or getting anything but only makes some UI level changes.)</p>
  <p><strong>Conditions:</strong> <em>Page must not be refreshed</em>, only a certain part of page is refreshed and that too only when that button is pressed.</p>
  <p>I have</p>
  <pre><code> &lt;wcbase:useBean id=&quot;beanUtil&quot; classname=&quot;UtilBean&quot;&gt;
          &lt;c:set property=&quot;studentId&quot; value=&quot;${WCParam.studentId}&quot; target=&quot;${beanUtil}&quot; /&gt;
          &lt;/wcbase:useBean&gt;
              &lt;c:set property=&quot;classId&quot; value=&quot;${class.uniqueID}&quot; target=&quot;${beanUtil}&quot; /&gt;
              &lt;c:set var=&quot;listOfStudents&quot; value=&quot;${beanUtil.StudentIdsforTransfer}&quot; /&gt;
                                  
              &lt;c:if test=&quot;${not empty listOfStudents}&quot;&gt;
                  &lt;script&gt;var listOfStudents= true; &lt;/script&gt;
              &lt;/c:if&gt;
              &lt;c:if test=&quot;${empty listOfStudents}&quot;&gt;
                  &lt;script&gt;var listOfStudents = false;&lt;/script&gt;
                  &lt;/c:if&gt;
  </code></pre>
  <p>I need to call this whole section on a button click</p>
  <p>how to do it?</p>
  <p>All the help would really be appreciated.</p>
  <p><strong>Note:</strong> I have tried to put this code in div and then tried to refresh that div on button click but it didnt work.</p>
  <p>something like :</p>
  <p>Put in js</p>
  <pre><code>  $('#studentDiv').load(document.URL +  '#studentDiv');
  </code></pre>
  <p>Put in jsp.</p>
  <pre><code> &lt;div id=&quot;studentDiv&quot;&gt;
  
   &lt;wcbase:useBean id=&quot;beanUtil&quot; classname=&quot;UtilBean&quot;&gt;
          &lt;c:set property=&quot;studentId&quot; value=&quot;${WCParam.studentId}&quot; target=&quot;${beanUtil}&quot; /&gt;
          &lt;/wcbase:useBean&gt;
              &lt;c:set property=&quot;classId&quot; value=&quot;${class.uniqueID}&quot; target=&quot;${beanUtil}&quot; /&gt;
              &lt;c:set var=&quot;listOfStudents&quot; value=&quot;${beanUtil.StudentIdsforTransfer}&quot; /&gt;
                                  
              &lt;c:if test=&quot;${not empty listOfStudents}&quot;&gt;
                  &lt;script&gt;var listOfStudents= true; &lt;/script&gt;
              &lt;/c:if&gt;
              &lt;c:if test=&quot;${empty listOfStudents}&quot;&gt;
                  &lt;script&gt;var listOfStudents = false;&lt;/script&gt;
                  &lt;/c:if&gt;
  &lt;/div&gt;
  </code></pre>
  <p>This code refreshed the page but inserted the whole page again with in the main page and stayed in process.</p>