title: New to applets/servlets - calling Java methods from JavaScript functions
body: <p>Apologies if this is basic or has been answered - I've never used applets/servlets before and couldn't find all the information I need by searching.</p>
  
  <p>I'm working with a team to create a simple music shuffler. The functions of the shuffler are to upvote, downvote, or skip the current playing song. Other members of the team have written these functions in Java, but it is my responsibility to display in a web app UI using HTML, JavaScript and an applet/servlet. It is running on a Tomcat v7.0 localhost.</p>
  
  <p>The upvote/downvote functions generate user preference based on tags associated to the current playing song. The user preference is then run through an algorithm to determine what song should be added to the playlist next (more on the playlist later). These functions are not my concern because I do not have to retrieve any information from them.</p>
  
  <p>The skip function first must dequeue the current playing song from the front of the playlist, which is managed as a queue with size 5. Then it will run the algorithm to enqueue a new song to the back of the queue. What I need returned for this function is the new playlist queue after it has been dequeued and enqueued.</p>
  
  <p>My questions are:</p>
  
  <ul>
  <li>Would an applet or servlet be more appropriate for this?</li>
  <li>If multiple Java classes are used, do I need to create a servlet for each one? Example: the Song class is used to create objects (songs) that are passed through the queue (playlist). Do I need to create an applet/servlet for both Song and the class with upvote/downvote/skip functions?</li>
  <li>Do applets/servlets give me access to global variables used in the Java classes, or only the variables returned? (On skip, do I need the new playlist returned to the JavaScript function so I may display it, or may I simply display the Java queue and load its div on skip)</li>
  </ul>
  
  <p>More information is available if needed. Thanks for any help.</p>