-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
2,453 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- You may freely edit this file. See commented blocks below for --> | ||
<!-- some examples of how to customize the build. --> | ||
<!-- (If you delete it and reopen the project it will be recreated.) --> | ||
<!-- By default, only the Clean and Build commands use this build script. --> | ||
<!-- Commands such as Run, Debug, and Test only use this build script if --> | ||
<!-- the Compile on Save feature is turned off for the project. --> | ||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting --> | ||
<!-- in the project's Project Properties dialog box.--> | ||
<project name="TossCoinWebApp" default="default" basedir="."> | ||
<description>Builds, tests, and runs the project TossCoinWebApp.</description> | ||
<import file="nbproject/build-impl.xml"/> | ||
<!-- | ||
There exist several targets which are by default empty and which can be | ||
used for execution of your tasks. These targets are usually executed | ||
before and after some main targets. They are: | ||
-pre-init: called before initialization of project properties | ||
-post-init: called after initialization of project properties | ||
-pre-compile: called before javac compilation | ||
-post-compile: called after javac compilation | ||
-pre-compile-single: called before javac compilation of single file | ||
-post-compile-single: called after javac compilation of single file | ||
-pre-compile-test: called before javac compilation of JUnit tests | ||
-post-compile-test: called after javac compilation of JUnit tests | ||
-pre-compile-test-single: called before javac compilation of single JUnit test | ||
-post-compile-test-single: called after javac compilation of single JUunit test | ||
-pre-dist: called before archive building | ||
-post-dist: called after archive building | ||
-post-clean: called after cleaning build products | ||
-pre-run-deploy: called before deploying | ||
-post-run-deploy: called after deploying | ||
Example of pluging an obfuscator after the compilation could look like | ||
<target name="-post-compile"> | ||
<obfuscate> | ||
<fileset dir="${build.classes.dir}"/> | ||
</obfuscate> | ||
</target> | ||
For list of available properties check the imported | ||
nbproject/build-impl.xml file. | ||
Other way how to customize the build is by overriding existing main targets. | ||
The target of interest are: | ||
init-macrodef-javac: defines macro for javac compilation | ||
init-macrodef-junit: defines macro for junit execution | ||
init-macrodef-debug: defines macro for class debugging | ||
do-dist: archive building | ||
run: execution of project | ||
javadoc-build: javadoc generation | ||
Example of overriding the target for project execution could look like | ||
<target name="run" depends="<PROJNAME>-impl.jar"> | ||
<exec dir="bin" executable="launcher.exe"> | ||
<arg file="${dist.jar}"/> | ||
</exec> | ||
</target> | ||
Notice that overridden target depends on jar target and not only on | ||
compile target as regular run target does. Again, for list of available | ||
properties which you can use check the target you are overriding in | ||
nbproject/build-impl.xml file. | ||
--> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Manifest-Version: 1.0 | ||
|
Binary file added
BIN
+1.72 KB
TossCoinWebApp/build/web/WEB-INF/classes/za/ac/tut/controller/AskUserServlet.class
Binary file not shown.
Binary file added
BIN
+1.76 KB
TossCoinWebApp/build/web/WEB-INF/classes/za/ac/tut/controller/GuessingGameServlet.class
Binary file not shown.
Binary file added
BIN
+1.67 KB
TossCoinWebApp/build/web/WEB-INF/classes/za/ac/tut/controller/StartServlet.class
Binary file not shown.
Binary file added
BIN
+1.71 KB
TossCoinWebApp/build/web/WEB-INF/classes/za/ac/tut/model/GuessGameCoin.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd"> | ||
<!-- | ||
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. | ||
This program and the accompanying materials are made available under the | ||
terms of the Eclipse Public License v. 2.0, which is available at | ||
http://www.eclipse.org/legal/epl-2.0. | ||
This Source Code may also be made available under the following Secondary | ||
Licenses when the conditions for such availability set forth in the | ||
Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
version 2 with the GNU Classpath Exception, which is available at | ||
https://www.gnu.org/software/classpath/license.html. | ||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
--> | ||
<glassfish-web-app error-url=""> | ||
<class-loader delegate="true"/> | ||
<jsp-config> | ||
<property name="keepgenerated" value="true"> | ||
<description>Keep a copy of the generated servlet class' java code.</description> | ||
</property> | ||
</jsp-config> | ||
</glassfish-web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> | ||
<servlet> | ||
<servlet-name>StartServlet</servlet-name> | ||
<servlet-class>za.ac.tut.controller.StartServlet</servlet-class> | ||
</servlet> | ||
<servlet> | ||
<servlet-name>AskUserServlet</servlet-name> | ||
<servlet-class>za.ac.tut.controller.AskUserServlet</servlet-class> | ||
</servlet> | ||
<servlet> | ||
<servlet-name>GuessingGameServlet</servlet-name> | ||
<servlet-class>za.ac.tut.controller.GuessingGameServlet</servlet-class> | ||
</servlet> | ||
<servlet-mapping> | ||
<servlet-name>StartServlet</servlet-name> | ||
<url-pattern>/StartServlet.do</url-pattern> | ||
</servlet-mapping> | ||
<servlet-mapping> | ||
<servlet-name>AskUserServlet</servlet-name> | ||
<url-pattern>/AskUserServlet.do</url-pattern> | ||
</servlet-mapping> | ||
<servlet-mapping> | ||
<servlet-name>GuessingGameServlet</servlet-name> | ||
<url-pattern>/GuessingGameServlet.do</url-pattern> | ||
</servlet-mapping> | ||
<session-config> | ||
<session-timeout> | ||
30 | ||
</session-timeout> | ||
</session-config> | ||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<%-- | ||
Document : file_not_found_error_page | ||
Created on : 25 Oct 2023, 8:31:48 AM | ||
Author : LEBO MERCY MOGALE | ||
--%> | ||
|
||
<%@page contentType="text/html" pageEncoding="UTF-8"%> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>FileNotFoundException Page</title> | ||
</head> | ||
<body> | ||
<h1>File not found error </h1> | ||
<p> | ||
The requested file was not found. | ||
Please click <a href="index.html">here</a> to go back to main page. | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd"> | ||
<!-- | ||
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. | ||
This program and the accompanying materials are made available under the | ||
terms of the Eclipse Public License v. 2.0, which is available at | ||
http://www.eclipse.org/legal/epl-2.0. | ||
This Source Code may also be made available under the following Secondary | ||
Licenses when the conditions for such availability set forth in the | ||
Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
version 2 with the GNU Classpath Exception, which is available at | ||
https://www.gnu.org/software/classpath/license.html. | ||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
--> | ||
<glassfish-web-app error-url=""> | ||
<class-loader delegate="true"/> | ||
<jsp-config> | ||
<property name="keepgenerated" value="true"> | ||
<description>Keep a copy of the generated servlet class' java code.</description> | ||
</property> | ||
</jsp-config> | ||
</glassfish-web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<%-- | ||
Document : guess_entry | ||
Created on : 25 Oct 2023, 8:31:23 AM | ||
Author : LEBO MERCY MOGALE | ||
--%> | ||
|
||
<%@page contentType="text/html" pageEncoding="UTF-8"%> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>Guess Page</title> | ||
</head> | ||
<body> | ||
<h1>Guess Head or Tail</h1> | ||
<form action="GuessingGameServlet.do" method="POST"> | ||
<table> | ||
<tr> | ||
<td>Guess:</td> | ||
<td> | ||
<input type="text" name="guessTH" /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td> | ||
<input type="submit" value="SUBMIT" /> | ||
</td> | ||
</tr> | ||
</table> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<%-- | ||
Document : guess_info | ||
Created on : 25 Oct 2023, 8:30:43 AM | ||
Author : LEBO MERCY MOGALE | ||
--%> | ||
|
||
<%@page contentType="text/html" pageEncoding="UTF-8"%> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>Guess Page</title> | ||
</head> | ||
<body> | ||
<h1>Outcome</h1> | ||
<% | ||
String guessTH = (String) request.getAttribute("guessTH"); | ||
String computerGuess = (String) request.getAttribute("computerGuess"); | ||
String outcome = (String) request.getAttribute("outcome"); | ||
%> | ||
<table> | ||
<tr> | ||
<td>User Guess: </td> | ||
<td> <%=guessTH%></td> | ||
</tr> | ||
<tr> | ||
<td>Computer Guess: </td> | ||
<td> <%=computerGuess%></td> | ||
</tr> | ||
<tr> | ||
<td>Outcome: </td> | ||
<td> <%=outcome%></td> | ||
</tr> | ||
</table> | ||
|
||
<form action="AskUserServlet.do" method="POST"> | ||
<tr> | ||
<td>Do you want to proceed with the game, yes or no?</td> | ||
<td> | ||
<input type="text" name="option" /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td> | ||
<input type="submit" value="SUBMIT" /> | ||
</td> | ||
</tr> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Html.html to edit this template | ||
--> | ||
<html> | ||
<head> | ||
<title>Welcome page</title> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
</head> | ||
<body> | ||
<h1>Welcome</h1> | ||
<p> | ||
Welcome to our app. Please click <a href="StartServlet.do">here</a> to start. | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<%-- | ||
Document : number_format_error_page | ||
Created on : 25 Oct 2023, 8:29:04 AM | ||
Author : LEBO MERCY MOGALE | ||
--%> | ||
|
||
<%@page contentType="text/html" pageEncoding="UTF-8"%> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>NumberFormatException Page</title> | ||
</head> | ||
<body> | ||
<h1>Number format error </h1> | ||
<p> | ||
An unexpected non-numeric number was entered. | ||
Please click <a href="index.html">here</a> to go back to main page. | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<%-- | ||
Document : summary | ||
Created on : 25 Oct 2023, 8:30:09 AM | ||
Author : LEBO MERCY MOGALE | ||
--%> | ||
|
||
<%@page contentType="text/html" pageEncoding="UTF-8"%> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>Summary Page</title> | ||
</head> | ||
<body> | ||
<h1>Summary</h1> | ||
<% | ||
Integer numTossMade = (Integer) session.getAttribute("numTossMade"); | ||
Integer tossWonByComputer = (Integer) session.getAttribute("tossWonByComputer"); | ||
Integer tossWonByUser = (Integer) session.getAttribute("tossWonByUser"); | ||
%> | ||
<table> | ||
<tr> | ||
<td>Number of tosses made: </td> | ||
<td><%=numTossMade%></td> | ||
</tr> | ||
<tr> | ||
<td>Number of tosses Won by Computer: </td> | ||
<td><%=tossWonByComputer%></td> | ||
</tr> | ||
<tr> | ||
<td>Number of tosses Won by User: </td> | ||
<td><%=tossWonByUser%></td> | ||
</tr> | ||
</table> | ||
<p>Please click <a href="index.html">here</a> to go back to home page</p> | ||
</body> | ||
</html> | ||
|
Binary file not shown.
Oops, something went wrong.