title: reloading a variable in a jsp page
body: <p>so I'm quite new to JSP, servlets and the like although I'm quite comfortable with all of the concepts in an MVC framework. In the following code:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt;
  &lt;title&gt;Some title&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="mostRecent"&gt;
  Most Recent Time: &lt;span id="mTime"&gt;&lt;/span&gt;&lt;br&gt;
  &lt;/div&gt;
  
  &lt;input id="butt" type="button" value="refresh" /&gt;
  
  &lt;script type="text/javascript"&gt;
  $(document).ready(function(){
      count = 0;
      $('#butt').click(function(){
          $('#mTime').text(" &lt;%= new java.util.Date() %&gt; ");
          count += 1;
      });
  });
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I click the refresh button the current date is written in the span as expected, but only the first time it is called ie. New more current date strings are not added, making me think that the method is being called (successfully) only once. Is there any way around this? Or even better, is there a problem in my general technique (ie. should I be making a request to a servlet for the time as to not add too much view logic). If that is the case then a description as to how I could load a servlet response into only a small part of the page (rather than printing the response to a new page) would be appreciated. Many thanks.</p>