title: How to assign a value to a variable (A java variable) on a button click in JSP?
body: <p>How can I assign a value to a variable in a JSP page, on a button click? </p>
  
  <p>I have a button "delete" in my JSP page. when a user clicks on this button it has to set a var (say a boolean flag or a string) to some value. How can I do this?</p>
  
  <pre><code>&lt;% boolean del=false; %&gt;
  &lt;input type="button" name="deleteAnswer" value="delete" onClick= &lt;Code to set del&gt; /&gt;
  &lt;% if(del) { My Code } %&gt;
  </code></pre>