Storing state on the client

First, we will develop our code storing the state on the client. The form needed to send the user input and the number of new full and partial matches, also contains all the previous colors for all the guesses and answers given at that time by the user. To do so, we create a new helper class to format the HTML code. This is something that is done in a modern enterprise environment using templates, JSP files, or just totally avoided using pure REST and a one-page application in the enterprise environment. Nevertheless, here we will use the old technology in order to demonstrate the gears that rotate under the hood of modern engines:

package packt.java9.by.example.mastermind.servlet; import packt.java9.by.example.mastermind.Color; ...

Get Java 9 Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.