This is in reference to this stack overflow post. I want to do something similar: on a specific event, I want the JavaScript to call the Ajax function which would then call the Java method. The person who answered the questions said to create a JSP file (for the java code). My java code use JAR files, so I could you import these JAR files to a JSP file? Would a better approach be to create a servlet?
(As a side note, would the JSP file contain all of my Java code?)