home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-tomcat-addon-1.4.9-installer.exe / numguess.jsp < prev    next >
Encoding:
Text File  |  2004-08-28  |  1.8 KB  |  70 lines

  1. <!--
  2. <!--
  3.   Copyright 2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16.  
  17.   Number Guess Game
  18.   Written by Jason Hunter, CTO, K&A Software
  19.   http://www.servlets.com
  20. -->
  21.  
  22. <%@ page import = "num.NumberGuessBean" %>
  23.  
  24. <jsp:useBean id="numguess" class="num.NumberGuessBean" scope="session"/>
  25. <jsp:setProperty name="numguess" property="*"/>
  26.  
  27. <html>
  28. <head><title>Number Guess</title></head>
  29. <body bgcolor="white">
  30. <font size=4>
  31.  
  32. <% if (numguess.getSuccess()) { %>
  33.  
  34.   Congratulations!  You got it.
  35.   And after just <%= numguess.getNumGuesses() %> tries.<p>
  36.  
  37.   <% numguess.reset(); %>
  38.  
  39.   Care to <a href="numguess.jsp">try again</a>?
  40.  
  41. <% } else if (numguess.getNumGuesses() == 0) { %>
  42.  
  43.   Welcome to the Number Guess game.<p>
  44.  
  45.   I'm thinking of a number between 1 and 100.<p>
  46.  
  47.   <form method=get>
  48.   What's your guess? <input type=text name=guess>
  49.   <input type=submit value="Submit">
  50.   </form>
  51.  
  52. <% } else { %>
  53.  
  54.   Good guess, but nope.  Try <b><%= numguess.getHint() %></b>.
  55.  
  56.   You have made <%= numguess.getNumGuesses() %> guesses.<p>
  57.  
  58.   I'm thinking of a number between 1 and 100.<p>
  59.  
  60.   <form method=get>
  61.   What's your guess? <input type=text name=guess>
  62.   <input type=submit value="Submit">
  63.   </form>
  64.  
  65. <% } %>
  66.  
  67. </font>
  68. </body>
  69. </html>
  70.