VTL code interaction with Java in Web Panel

Hi, I’ve a use case where in the Jira issue page we have a web-panel to render. Now we need to render the details page[API heavy] only when user clicks on “Show Details” button.

<web-panel name="AQIssueConnect" i18n-name-key="aq-issue-connect.name" key="aq-issue-connect" location="atl.jira.view.issue.left.context" weight="400"> 
    <condition class="com.accelq.plugins.jira.conditions.AQTracabilityDisplayCondition"/>  
    <description key="aq-issue-connect.description">The AQIssueConnect Plugin</description>  
    <context-provider class="com.accelq.plugins.jira.providers.AQIssueConnect"/>  
    <resource name="view" type="velocity" location="templates/aq-issue-view/aq-issue-view.vm"/>  
    <label key="aq-issue-view.title"/> 
  </web-panel>  
</atlassian-plugin>

So, how can I bind the onclick event to call a method in Java class AQIssueConnect, which updates the contextMap and reloads the webpanel