title: To invoke java function from velocity template during onclick event
body: <p>Web application uses struts2 and velocity</p>
  
  <p>1)</p>
  
  <p>The velocity file has a link and when the link is clicked i want java function to be called.</p>
  
  <p>productform.vm</p>
  
  <hr>
  
  <pre><code> &lt;a href="javascript:void(0);" onclick="*************" id="acnt_link"&gt; Add Acnt &lt;/a&gt; 
  </code></pre>
  
  <p>when the link from velocity file is clicked, i need java function to be called</p>
  
  <h2>abc.java</h2>
  
  <pre><code>public void printabc(){
  syso("Java function called when link from velocity temp is clicked");
  }
  </code></pre>
  
  <p>Please advise on how to do this</p>
  
  <p>2)</p>
  
  <p>i can invoke javascript function when link from velocity is clicked, but from javascript function how can i call the java function(for example abc.printabc())</p>
  
  <p>Please advise.</p>