I am working on a board game with dynamic board size of 5x5,...,8x8
This should be a game that runs on a web.
I am working with NetBeans and tomcat as the server for testing.
I have the GameSettings.html which the user choose the board size and press submit.
The data is being sent to servlet named: GameSettingsServlet.java
There I pull out the boardSize and parse it to an integer:
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
createEngine(request);
processRequest(request, response);
}
private void createEngine(HttpServletRequest request)
{
int boardSize = Integer.parseInt(request.getParameter("boardSize"));
int numberOfPlayers = Integer.parseInt(request.getParameter("numberOfPlayers"));
m_Engine = new Engine(boardSize, numberOfPlayers );
}
I want to create the board with javaScript so I need to send the boardSize parameter to the javaScript (which should run on BoardGame.html) in order to know how much rows and columns to create.
How can I pass the boardSize to the javaScript or HTML ?
I searched on the web but I found only about JSP and I need it on HTML.