Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 771 | blopes | 1 | <!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%-- |
| 2 | Licensed to the Apache Software Foundation (ASF) under one or more |
||
| 3 | contributor license agreements. See the NOTICE file distributed with |
||
| 4 | this work for additional information regarding copyright ownership. |
||
| 5 | The ASF licenses this file to You under the Apache License, Version 2.0 |
||
| 6 | (the "License"); you may not use this file except in compliance with |
||
| 7 | the License. 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 | --%> |
||
| 19 | |||
| 20 | <%@ page import = "num.NumberGuessBean" %> |
||
| 21 | |||
| 22 | <jsp:useBean id="numguess" class="num.NumberGuessBean" scope="session"/> |
||
| 23 | <jsp:setProperty name="numguess" property="*"/> |
||
| 24 | |||
| 25 | <html> |
||
| 26 | <head><title>Number Guess</title></head> |
||
| 27 | <body bgcolor="white"> |
||
| 28 | <font size=4> |
||
| 29 | |||
| 30 | <% if (numguess.getSuccess()) { %> |
||
| 31 | |||
| 32 | Congratulations! You got it. |
||
| 33 | And after just <%= numguess.getNumGuesses() %> tries.<p> |
||
| 34 | |||
| 35 | <% numguess.reset(); %> |
||
| 36 | |||
| 37 | Care to <a href="numguess.jsp">try again</a>? |
||
| 38 | |||
| 39 | <% } else if (numguess.getNumGuesses() == 0) { %> |
||
| 40 | |||
| 41 | Welcome to the Number Guess game.<p> |
||
| 42 | |||
| 43 | I'm thinking of a number between 1 and 100.<p> |
||
| 44 | |||
| 45 | <form method=get> |
||
| 46 | What's your guess? <input type=text name=guess> |
||
| 47 | <input type=submit value="Submit"> |
||
| 48 | </form> |
||
| 49 | |||
| 50 | <% } else { %> |
||
| 51 | |||
| 52 | Good guess, but nope. Try <b><%= numguess.getHint() %></b>. |
||
| 53 | |||
| 54 | You have made <%= numguess.getNumGuesses() %> guesses.<p> |
||
| 55 | |||
| 56 | I'm thinking of a number between 1 and 100.<p> |
||
| 57 | |||
| 58 | <form method=get> |
||
| 59 | What's your guess? <input type=text name=guess> |
||
| 60 | <input type=submit value="Submit"> |
||
| 61 | </form> |
||
| 62 | |||
| 63 | <% } %> |
||
| 64 | |||
| 65 | </font> |
||
| 66 | </body> |
||
| 67 | </html> |
||
| 68 | </pre></body></html> |