<%@ page import = "num.NumberGuessBean" %> TMG5383 - Modified Number Guess Game <% if (numguess.getSuccess()) { %> <%-- Made the correct guess. --%> Congratulations! You got it. And after just <%= numguess.getNumGuesses() %> tries.

<% numguess.reset(); %> Care to try again? <% } else if (numguess.getNumGuesses() == 0) { %> <%-- if No guesses, disply the initial text --%> Welcome to the Number Guess game.

I'm thinking of a number between 1 and 100.

What's your guess?
<% } else { %> <%-- Made one or more guesses, give feedback and try again --%> Your last guess was <%= numguess.getCurrentGuess() %>

<%-- Really should use custom tags to eliminate logic tests in JSP code!!! --%> <% if (numguess.isGuessClose()) { %> You're getting warmer! <% } else { %> A Good guess, <% } %> but nope. Try <%= numguess.getHint() %>. You have made <%= numguess.getNumGuesses() %> guesses.

I'm thinking of a number between 1 and 100.

What's your guess?
<%-- Close the logic branch --%> <% } %>

This and other examples are available at:
http://www.WEFConsulting.net/examples