title: Call Java method by using Ajax
body: <p>This is in reference to <a href="https://stackoverflow.com/questions/15944000/calling-a-java-method-in-ajax">this stack overflow post</a>. 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? </p>
  
  <p>(As a side note, would the JSP file contain all of my Java code?)</p>