I'm making a web application with a Java engine. How can I easily transfer my server-side data from the Java code to the client-side code (HTML, css, JavaScript,...). I know about servlets but I don't know how to properly work with them.
We have a fully functional Java engine, a GUI made in HTML and CSS, now we need to use the data in both ways.
Here is some code in my servlet constructor:
public GameServlet() {
    super();
    int numberOfPlayers = 4;
    int[] wins = {1,2,3,4};
    int[] losses = {1,2,3,4};
    String[] players = {"player1", "player2", "player3", "player4"};
    Game game = new Game(numberOfPlayers, players, wins, losses);
    System.out.println("test");
    System.out.println(players[3]);
    game.Start();
}
How can I access for example the players array in my JavaScript code?
 
     
     
    