O'Reilly logo

Java 9 Programming By Example by Peter Verhas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required