AEM front end logic (JSP or HTL) communicate with Java backend OSGi services using:
So in both cases - a front end AEM component is interacting with Java located in an OSGi bundle located in the AEM OSGi service container.
Having said that - the only way i can think of to successfully let an AEM front end interat with Java located on a J2EE servlet outside of AEM is to build an AEM component and use AJAX to invoke a servlet outside of AEM:
//Use JQuery AJAX request to post data to a Sling Servlet
$.ajax({
type: 'POST',
url:<URL OUT OF AEM>/mySearchServlet',
data:'id='+ claimId+'&firstName='+ myFirst+'&lastName='+ myLast+'&address='+ address+'&cat='+ cat+'&state='+ state+'&details='+ details+'&date='+ date+'&city='+ city,
success: function(msg){
alert(msg); //display the data returned by the servlet
}
});