MP hell MP hell MP hell MP hell

master
Caleb Fontenot 2023-09-08 21:14:06 +07:00
parent f3d65894e2
commit 204f9db501
177 changed files with 1326 additions and 0 deletions

3
.gitignore vendored

@ -42,3 +42,6 @@
/Semester 2/lab5_EL1_F23_CalebFontenot/target/
/Semester 2/labEL2_CalebFontenot/target/
/Semester 2/MP2-chapter4_Java20_CalebFontenot/nbproject/private/
/Semester 2/Assignments/SwingTest/target/
/Semester 2/Assignments/MP2_BusinessLogic_CalebFontenot/target/

@ -0,0 +1,77 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.slcc.asdv.caleb</groupId>
<artifactId>MP2_BusinessLogic_CalebFontenot</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>MP2_BusinessLogic_CalebFontenot-1.0-SNAPSHOT</name>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<jakartaee>10.0.0</jakartaee>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,47 @@
package com.corejsf;
import java.util.ArrayList;
import java.util.List;
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
/**
*
* @author caleb
*/
public class Data {
private ArrayList<Problem> problems = new ArrayList<>();
public Data() {
problems.add(new Problem("Java is a purely procedural programming language.", false));
problems.add(new Problem("Java is platform-independent due to its bytecode and JVM (Java Virtual Machine).", true));
problems.add(new Problem("A Java method can have multiple return statements.", true));
problems.add(new Problem("In Java, you can create an object of an abstract class.", false));
problems.add(new Problem("Java supports multiple inheritance for classes.", false));
problems.add(new Problem("The NullPointerException is a checked exception in Java.", false));
problems.add(new Problem("The final keyword in Java can be used to prevent method overriding.", true));
problems.add(new Problem("The == operator in Java compares the values of two objects.", false));
problems.add(new Problem("Java provides automatic memory management through garbage collection.", true));
problems.add(new Problem("Java's switch statement can be used with floating-point numbers.", false));
}
public ArrayList<Problem> getData() {
return problems;
}
public List<String> getQuestions() {
List<String> returnArray = new ArrayList<String>();
for (Problem problem: problems) {
returnArray.add(problem.getQuestion());
}
return returnArray;
}
public ArrayList<Boolean> getAnswers(){
ArrayList<Boolean> returnArray = new ArrayList<Boolean>();
for(Problem problem: problems) {
returnArray.add(problem.isCorrectAnswer());
}
return returnArray;
}
}

@ -0,0 +1,33 @@
package com.corejsf;
import java.io.Serializable;
public class Problem implements Serializable, ProblemInterface {
private String question;
private boolean answer;
public Problem() {}
public Problem(String question, boolean solution) {
this.question = question;
this.answer = solution;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public boolean isCorrectAnswer() {
return answer;
}
public void setAnswer(boolean answer) {
this.answer = answer;
}
}

@ -0,0 +1,19 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package com.corejsf;
/**
*
* @author caleb
*/
public interface ProblemInterface {
public String getQuestion();
public void setQuestion(String question);
public boolean isCorrectAnswer();
public void setAnswer(boolean answer);
}

@ -0,0 +1,90 @@
package com.corejsf;
import ejb.TestEJBLocal;
import jakarta.enterprise.context.SessionScoped;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.context.FacesContext;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Locale;
@Named // or @Named
@SessionScoped
public class QuizBean implements Serializable {
@Inject
TestEJBLocal ejb;
public String getDataFromDatabase() {
return ejb.getDataFromDatabase().toString();
}
private int currentLocale = 0;
private Data theProblems = new Data();
private int currentIndex;
private int score;
public int getScore() {
return score;
}
public Problem getCurrent() {
return theProblems.getData().get(currentIndex);
}
public String getAnswer() {
return "";
}
public void setAnswer(String newValue) {
System.out.println("Called setAnswer\nAnswer was: " + newValue);
boolean answer = (Boolean.parseBoolean(newValue));
try {
if (newValue != "true"&& newValue != "false") {
// if the newValue is blank, make sure the answer gets interpreted as incorrect.
System.out.println("Answer was blank!");
answer = !getCurrent().isCorrectAnswer();
}
if (getCurrent().isCorrectAnswer() == answer) {
score++;
}
currentIndex = (currentIndex + 1) % theProblems.getData().size();
} catch (Exception ex) {
}
}
public void previousQuestion() {
if (currentIndex > 0) {
currentIndex = (currentIndex - 1);
} else {
currentIndex = theProblems.getData().size() - 1;
}
}
public void setLanguage(int locale) {
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
switch (locale) {
default:
case 0:
viewRoot.setLocale(new Locale("en")); //English
break;
case 1:
viewRoot.setLocale(new Locale("es")); //Spanish
break;
case 2:
viewRoot.setLocale(new Locale("fr")); //French
break;
case 3:
viewRoot.setLocale(new Locale("ru")); //Russian
break;
case 4:
viewRoot.setLocale(new Locale("el")); //Greek
break;
case 5:
viewRoot.setLocale(new Locale("ar")); //Arabic
break;
}
}
}

@ -0,0 +1,18 @@
# Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
# Click nbfs://nbhost/SystemFileSystem/Templates/Other/properties.properties to edit this template
currentLocale=Current Locale: English
title=Java Quiz
heading=Have fun with Java Quiz!
currentScore=Your current score is {0}.
guessNext=Answer the question correctly by typing 'true' or 'false' in the text box.
answer=Your answer:
next=Next
previous=Previous
englishLocale=Change locale to English
spanishLocale=Change locale to Spanish
frenchLocale=Change locale to French
greekLocale=Change locale to Greek
arabicLocale=Change locale to Arabic
russianLocale=Change locale to Russian

@ -0,0 +1,17 @@
# Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
# Click nbfs://nbhost/SystemFileSystem/Templates/Other/properties.properties to edit this template
currentLocale=\u0627\u0644\u0644\u063a\u0629 \u0627\u0644\u062d\u0627\u0644\u064a\u0629: \u0627\u0644\u0639\u0631\u0628\u064a\u0629
title=\u0627\u062e\u062a\u0628\u0627\u0631 \u062c\u0627\u0641\u0627
heading=\u0627\u0633\u062a\u0645\u062a\u0639 \u0645\u0639 Java Quiz!
currentScore=\u0646\u062a\u064a\u062c\u062a\u0643 \u0627\u0644\u062d\u0627\u0644\u064a\u0629 \u0647\u064a {0}.
guessNext=\u0623\u062c\u0628 \u0639\u0646 \u0627\u0644\u0633\u0624\u0627\u0644 \u0628\u0634\u0643\u0644 \u0635\u062d\u064a\u062d \u0639\u0646 \u0637\u0631\u064a\u0642 \u0643\u062a\u0627\u0628\u0629 "\u0635\u062d\u064a\u062d" \u0623\u0648 "\u062e\u0637\u0623" \u0641\u064a \u0645\u0631\u0628\u0639 \u0627\u0644\u0646\u0635.
answer=\u0625\u062c\u0627\u0628\u062a\u0643:
next=\u0627\u0644\u062a\u0627\u0644\u064a
previous=\u0627\u0644\u0633\u0627\u0628\u0642
englishLocale=\u062a\u063a\u064a\u064a\u0631 \u0627\u0644\u0644\u063a\u0629 \u0625\u0644\u0649 \u0627\u0644\u0625\u0646\u062c\u0644\u064a\u0632\u064a\u0629
spanishLocale=\u062a\u063a\u064a\u064a\u0631 \u0627\u0644\u0644\u063a\u0629 \u0625\u0644\u0649 \u0627\u0644\u0625\u0633\u0628\u0627\u0646\u064a\u0629
frenchLocale=\u062a\u063a\u064a\u064a\u0631 \u0627\u0644\u0644\u063a\u0629 \u0625\u0644\u0649 \u0627\u0644\u0641\u0631\u0646\u0633\u064a\u0629
greekLocale=\u062a\u063a\u064a\u064a\u0631 \u0627\u0644\u0644\u063a\u0629 \u0625\u0644\u0649 \u0627\u0644\u064a\u0648\u0646\u0627\u0646\u064a\u0629
arabicLocale=\u062a\u063a\u064a\u064a\u0631 \u0627\u0644\u0644\u063a\u0629 \u0625\u0644\u0649 \u0627\u0644\u0644\u063a\u0629 \u0627\u0644\u0639\u0631\u0628\u064a\u0629
russianLocale=\u062a\u063a\u064a\u064a\u0631 \u0627\u0644\u0644\u063a\u0629 \u0625\u0644\u0649 \u0627\u0644\u0631\u0648\u0633\u064a\u0629

@ -0,0 +1,17 @@
# Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
# Click nbfs://nbhost/SystemFileSystem/Templates/Other/properties.properties to edit this template
currentLocale=\u03a4\u03c1\u03ad\u03c7\u03bf\u03c5\u03c3\u03b1 \u03c4\u03bf\u03c0\u03bf\u03b8\u03b5\u03c3\u03af\u03b1: \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac
title=Java Quiz
heading=\u0394\u03b9\u03b1\u03c3\u03ba\u03b5\u03b4\u03ac\u03c3\u03c4\u03b5 \u03bc\u03b5 \u03c4\u03bf Java Quiz!
currentScore=\u0397 \u03c4\u03c1\u03ad\u03c7\u03bf\u03c5\u03c3\u03b1 \u03b2\u03b1\u03b8\u03bc\u03bf\u03bb\u03bf\u03b3\u03af\u03b1 \u03c3\u03b1\u03c2 \u03b5\u03af\u03bd\u03b1\u03b9 {0}.
guessNext=\u0391\u03c0\u03b1\u03bd\u03c4\u03ae\u03c3\u03c4\u03b5 \u03c3\u03c9\u03c3\u03c4\u03ac \u03c3\u03c4\u03b7\u03bd \u03b5\u03c1\u03ce\u03c4\u03b7\u03c3\u03b7 \u03c0\u03bb\u03b7\u03ba\u03c4\u03c1\u03bf\u03bb\u03bf\u03b3\u03ce\u03bd\u03c4\u03b1\u03c2 "true" \u03ae "false" \u03c3\u03c4\u03bf \u03c0\u03bb\u03b1\u03af\u03c3\u03b9\u03bf \u03ba\u03b5\u03b9\u03bc\u03ad\u03bd\u03bf\u03c5.
answer=\u0397 \u03b1\u03c0\u03ac\u03bd\u03c4\u03b7\u03c3\u03ae \u03c3\u03b1\u03c2:
next=\u0395\u03c0\u03cc\u03bc\u03b5\u03bd\u03bf
previous=\u03a0\u03c1\u03bf\u03b7\u03b3\u03bf\u03cd\u03bc\u03b5\u03bd\u03bf
englishLocale=\u0391\u03bb\u03bb\u03b1\u03b3\u03ae \u03c4\u03bf\u03c0\u03b9\u03ba\u03ce\u03bd \u03c1\u03c5\u03b8\u03bc\u03af\u03c3\u03b5\u03c9\u03bd \u03c3\u03b5 \u0391\u03b3\u03b3\u03bb\u03b9\u03ba\u03ac
spanishLocale=\u0391\u03bb\u03bb\u03b1\u03b3\u03ae \u03c4\u03bf\u03c0\u03b9\u03ba\u03ce\u03bd \u03c1\u03c5\u03b8\u03bc\u03af\u03c3\u03b5\u03c9\u03bd \u03c3\u03b5 \u0399\u03c3\u03c0\u03b1\u03bd\u03b9\u03ba\u03ac
frenchLocale=\u0391\u03bb\u03bb\u03b1\u03b3\u03ae \u03c4\u03bf\u03c0\u03b9\u03ba\u03ae\u03c2 \u03b3\u03bb\u03ce\u03c3\u03c3\u03b1\u03c2 \u03c3\u03b5 \u03b3\u03b1\u03bb\u03bb\u03b9\u03ba\u03ac
greekLocale=\u0391\u03bb\u03bb\u03b1\u03b3\u03ae \u03c4\u03bf\u03c0\u03b9\u03ba\u03ae\u03c2 \u03c1\u03cd\u03b8\u03bc\u03b9\u03c3\u03b7\u03c2 \u03c3\u03b5 \u03b5\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac
arabicLocale=\u0391\u03bb\u03bb\u03b1\u03b3\u03ae \u03c4\u03bf\u03c0\u03b9\u03ba\u03ce\u03bd \u03c1\u03c5\u03b8\u03bc\u03af\u03c3\u03b5\u03c9\u03bd \u03c3\u03b5 \u03b1\u03c1\u03b1\u03b2\u03b9\u03ba\u03ac
russianLocale=\u0391\u03bb\u03bb\u03b1\u03b3\u03ae \u03c4\u03bf\u03c0\u03b9\u03ba\u03ce\u03bd \u03c1\u03c5\u03b8\u03bc\u03af\u03c3\u03b5\u03c9\u03bd \u03c3\u03b5 \u03a1\u03c9\u03c3\u03b9\u03ba\u03ac

@ -0,0 +1,17 @@
# Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
# Click nbfs://nbhost/SystemFileSystem/Templates/Other/properties.properties to edit this template
currentLocale=Configuraci\u00f3n regional actual: espa\u00f1ol
title=Configuraci\u00f3n regional actual: ingl\u00e9s
heading=\u00a1Divi\u00e9rtete con Java Quiz!
currentScore=Su puntuaci\u00f3n actual es {0}.
guessNext=Responda la pregunta correctamente escribiendo 'verdadero' o 'falso' en el cuadro de texto.
answer=Tu respuesta:
next=Siguiente
previous=Anterior
englishLocale=Cambiar configuraci\u00f3n regional a ingl\u00e9s
spanishLocale=Cambiar configuraci\u00f3n regional a espa\u00f1ol
frenchLocale=Cambiar configuraci\u00f3n regional a franc\u00e9s
greekLocale=Cambiar configuraci\u00f3n regional a griego
arabicLocale=Cambiar configuraci\u00f3n regional a \u00e1rabe
russianLocale = Cambiar la configuraci\u00f3n regional a Rusa

@ -0,0 +1,17 @@
# Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
# Click nbfs://nbhost/SystemFileSystem/Templates/Other/properties.properties to edit this template
currentLocale=Locale actuelle : fran\u00e7ais
title=Quiz Java
heading=Amusez-vous avec Java Quiz!
currentScore=Votre score actuel est de {0}.
guessNext=R\u00e9pondez correctement \u00e0 la question en tapant \u00ab vrai \u00bb ou \u00ab faux \u00bb dans la zone de texte.
answer=Votre r\u00e9ponse :
next=Suivant
previous=Pr\u00e9c\u00e9dent
englishLocale=Changer les param\u00e8tres r\u00e9gionaux en anglais
spanishLocale=Changer les param\u00e8tres r\u00e9gionaux en espagnol
frenchLocale=Changer les param\u00e8tres r\u00e9gionaux en fran\u00e7ais
greekLocale=Changer les param\u00e8tres r\u00e9gionaux en grec
arabicLocale=Changer les param\u00e8tres r\u00e9gionaux en arabe
russianLocale=Changer les param\u00e8tres r\u00e9gionaux en russe

@ -0,0 +1,17 @@
# Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
# Click nbfs://nbhost/SystemFileSystem/Templates/Other/properties.properties to edit this template
currentLocale=\u0422\u0435\u043a\u0443\u0449\u0430\u044f \u043b\u043e\u043a\u0430\u043b\u044c: \u0420\u0443\u0441\u0441\u043a\u0438\u0439
title=Java-\u0432\u0438\u043a\u0442\u043e\u0440\u0438\u043d\u0430
heading=\u0423\u0434\u0430\u0447\u0438 \u0432 Java-\u0432\u0438\u043a\u0442\u043e\u0440\u0438\u043d\u0435!
currentScore=\u0412\u0430\u0448 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: {0}.
guessNext=\u041e\u0442\u0432\u0435\u0442\u044c\u0442\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441, \u043d\u0430\u0431\u0440\u0430\u0432 \u00ab\u0438\u0441\u0442\u0438\u043d\u0430\u00bb \u0438\u043b\u0438 \u00ab\u043b\u043e\u0436\u044c\u00bb \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435.
answer=\u0412\u0430\u0448 \u043e\u0442\u0432\u0435\u0442:
next=\u0414\u0430\u043b\u0435\u0435
previous=\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439
englishLocale=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439
spanishLocale=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c \u043d\u0430 \u0438\u0441\u043f\u0430\u043d\u0441\u043a\u0438\u0439
frenchLocale=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c \u043d\u0430 \u0444\u0440\u0430\u043d\u0446\u0443\u0437\u0441\u043a\u0438\u0439
greekLocale=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c \u043d\u0430 \u0433\u0440\u0435\u0447\u0435\u0441\u043a\u0438\u0439
arabicLocale=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c \u043d\u0430 \u0430\u0440\u0430\u0431\u0441\u043a\u0438\u0439
russianLocale=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>#{msgs.title}</title>
</h:head>
<h:body>
<h:form>
<h3>#{msgs.heading}</h3>
<p>
<h:outputFormat value="#{msgs.currentScore}">
<f:param value="#{quizBean.score}"/>
</h:outputFormat>
</p>
<p>#{msgs.guessNext}</p>
<p>#{quizBean.current.question}</p>
<p>
#{msgs.answer}
<h:inputText value="#{quizBean.answer}"/>
</p>
<p><h:button value="#{msgs.previous}" onclick="#{quizBean.previousQuestion()}"/><h:commandButton value="#{msgs.next}"/></p>
</h:form>
<h:form>
<label>#{msgs.currentLocale} </label> <br/>
<h:commandButton value="#{msgs.englishLocale}" action="#{quizBean.setLanguage(0)}"/>
<h:commandButton value="#{msgs.spanishLocale}" action="#{quizBean.setLanguage(1)}"/>
<h:commandButton value="#{msgs.frenchLocale}" action="#{quizBean.setLanguage(2)}"/>
<h:commandButton value="#{msgs.greekLocale}" action="#{quizBean.setLanguage(4)}"/>
<h:commandButton value="#{msgs.arabicLocale}" action="#{quizBean.setLanguage(5)}"/>
<h:commandButton value="#{msgs.russianLocale}" action="#{quizBean.setLanguage(3)}"/>
</h:form>
</h:body>
</html>

@ -0,0 +1,83 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Navigator.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.literal {color: #cc7832}
.ST2 {font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.string {color: #6a8759}
.number {color: #6897bb}
.ST1 {color: #ffc66d}
.whitespace {color: #505050}
.comment {color: #808080}
.ST3 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 3/Assignments/MP2_Navigation_CalebFontenot/src/main/java/edu/slcc/asdv/pojo/Navigator.java</td></tr></table>
<pre>
<span class="literal">package</span> edu.slcc.asdv.pojo;
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">import</span> jakarta.inject.Named;
<span class="literal">import</span> jakarta.enterprise.context.RequestScoped;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
@Named(value = <span class="string">&quot;</span><span class="string">Navigator</span><span class="string">&quot;</span>)
@RequestScoped
<span class="literal">public</span> <span class="literal">class</span> Navigator {
<span class="comment">/**</span>
<span class="comment"> * </span><span class="comment">Creates</span> <span class="comment">a</span> <span class="comment">new</span> <span class="comment">instance</span> <span class="comment">of</span> <span class="comment">Navigator</span>
<span class="comment">*/</span>
<span class="literal">public</span> Navigator() {
}
<span class="literal">public</span> String <span class="ST1">determine</span>(String origin) {
<span class="literal">int</span> rand = (<span class="literal">int</span>) (Math.<span class="ST2">random</span>() * <span class="number">2</span>);
System.<span class="ST3">out</span>.println(rand);
String returnValue = <span class="string">&quot;&quot;</span>;
<span class="literal">switch</span> (origin) {
<span class="literal">case</span> <span class="string">&quot;</span><span class="string">a</span><span class="string">&quot;</span>:
<span class="literal">if</span> (rand == <span class="number">0</span>) {
returnValue = <span class="string">&quot;</span><span class="string">b.xhtml</span><span class="string">&quot;</span>;
} <span class="literal">else</span> {
returnValue = <span class="string">&quot;</span><span class="string">defeat.xhtml</span><span class="string">&quot;</span>;
}
<span class="literal">break</span>;
<span class="literal">case</span> <span class="string">&quot;</span><span class="string">b</span><span class="string">&quot;</span>:
<span class="literal">if</span> (rand == <span class="number">0</span>) {
returnValue = <span class="string">&quot;</span><span class="string">c.xhtml</span><span class="string">&quot;</span>;
} <span class="literal">else</span> {
returnValue = <span class="string">&quot;</span><span class="string">defeat.xhtml</span><span class="string">&quot;</span>;
}
<span class="literal">break</span>;
<span class="literal">case</span> <span class="string">&quot;</span><span class="string">c</span><span class="string">&quot;</span>:
<span class="literal">if</span> (rand == <span class="number">0</span>) {
returnValue = <span class="string">&quot;</span><span class="string">victory.xhtml</span><span class="string">&quot;</span>;
} <span class="literal">else</span> {
returnValue = <span class="string">&quot;</span><span class="string">defeat.xhtml</span><span class="string">&quot;</span>;
}
<span class="literal">break</span>;
}
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">Return value: </span><span class="string">&quot;</span> + returnValue);
<span class="literal">return</span> returnValue;
}
}
</pre></body>
</html>

@ -0,0 +1,42 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>a.xhtml</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.highlight-caret-row {background-color: #323232}
.expression-language {background-color: #232525}
.ST0 {color: #628fb5}
.ST2 {color: #287bde}
.ST6 {color: #6a8759; background-color: #232525}
.ST5 {color: #a5c261}
.ST3 {color: #e8bf6a}
.ST1 {color: #505050}
.ST4 {color: #bababa}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 3/Assignments/MP2_Navigation_CalebFontenot/src/main/webapp/a.xhtml</td></tr></table>
<pre>
<span class="highlight-caret-row">&lt;?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39; ?&gt;</span>
<span class="ST0">&lt;!DOCTYPE</span> <span class="ST0">html</span> <span class="ST0">PUBLIC</span> <span class="ST0">&quot;-//W3C//DTD</span> <span class="ST0">XHTML</span> <span class="ST0">1.0</span> <span class="ST0">Transitional//EN&quot;</span> <span class="ST0">&quot;</span><span class="ST2">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</span><span class="ST0">&quot;</span><span class="ST0">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">html</span> <span class="ST4">xmlns</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://www.w3.org/1999/xhtml</span><span class="ST5">&quot;</span>
<span class="ST4">xmlns:h</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://xmlns.jcp.org/jsf/html</span><span class="ST5">&quot;</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">title</span><span class="ST3">&gt;</span>a<span class="ST3">&lt;/</span><span class="ST3">title</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h1</span><span class="ST3">&gt;</span>You are on A.<span class="ST3">&lt;/</span><span class="ST3">h1</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:commandLink</span> <span class="ST4">value</span><span class="ST4">=</span><span class="ST5">&quot;try to go to b&quot;</span> <span class="ST4">action</span><span class="ST4">=</span><span class="ST5">&#39;</span><span class="expression-language">#{</span><span class="expression-language">Navigator</span><span class="expression-language">.</span><span class="expression-language">determine</span><span class="expression-language">(</span><span class="ST6">&quot;a&quot;</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST5">&#39;</span><span class="ST3">/</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">html</span><span class="ST3">&gt;</span>
</pre></body>
</html>

@ -0,0 +1,42 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>b.xhtml</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.highlight-caret-row {background-color: #323232}
.expression-language {background-color: #232525}
.ST0 {color: #628fb5}
.ST2 {color: #287bde}
.ST6 {color: #6a8759; background-color: #232525}
.ST5 {color: #a5c261}
.ST3 {color: #e8bf6a}
.ST1 {color: #505050}
.ST4 {color: #bababa}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 3/Assignments/MP2_Navigation_CalebFontenot/src/main/webapp/b.xhtml</td></tr></table>
<pre>
<span class="highlight-caret-row">&lt;?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39; ?&gt;</span>
<span class="ST0">&lt;!DOCTYPE</span> <span class="ST0">html</span> <span class="ST0">PUBLIC</span> <span class="ST0">&quot;-//W3C//DTD</span> <span class="ST0">XHTML</span> <span class="ST0">1.0</span> <span class="ST0">Transitional//EN&quot;</span> <span class="ST0">&quot;</span><span class="ST2">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</span><span class="ST0">&quot;</span><span class="ST0">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">html</span> <span class="ST4">xmlns</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://www.w3.org/1999/xhtml</span><span class="ST5">&quot;</span>
<span class="ST4">xmlns:h</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://xmlns.jcp.org/jsf/html</span><span class="ST5">&quot;</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">title</span><span class="ST3">&gt;</span>b<span class="ST3">&lt;/</span><span class="ST3">title</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h1</span><span class="ST3">&gt;</span>Success! You are on B!<span class="ST3">&lt;/</span><span class="ST3">h1</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:commandLink</span> <span class="ST4">value</span><span class="ST4">=</span><span class="ST5">&quot;try to go to c&quot;</span> <span class="ST4">action</span><span class="ST4">=</span><span class="ST5">&#39;</span><span class="expression-language">#{</span><span class="expression-language">Navigator</span><span class="expression-language">.</span><span class="expression-language">determine</span><span class="expression-language">(</span><span class="ST6">&quot;b&quot;</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST5">&#39;</span><span class="ST3">/</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">html</span><span class="ST3">&gt;</span>
</pre></body>
</html>

@ -0,0 +1,42 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>c.xhtml</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.highlight-caret-row {background-color: #323232}
.expression-language {background-color: #232525}
.ST0 {color: #628fb5}
.ST2 {color: #287bde}
.ST6 {color: #6a8759; background-color: #232525}
.ST5 {color: #a5c261}
.ST3 {color: #e8bf6a}
.ST1 {color: #505050}
.ST4 {color: #bababa}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 3/Assignments/MP2_Navigation_CalebFontenot/src/main/webapp/c.xhtml</td></tr></table>
<pre>
<span class="highlight-caret-row">&lt;?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39; ?&gt;</span>
<span class="ST0">&lt;!DOCTYPE</span> <span class="ST0">html</span> <span class="ST0">PUBLIC</span> <span class="ST0">&quot;-//W3C//DTD</span> <span class="ST0">XHTML</span> <span class="ST0">1.0</span> <span class="ST0">Transitional//EN&quot;</span> <span class="ST0">&quot;</span><span class="ST2">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</span><span class="ST0">&quot;</span><span class="ST0">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">html</span> <span class="ST4">xmlns</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://www.w3.org/1999/xhtml</span><span class="ST5">&quot;</span>
<span class="ST4">xmlns:h</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://xmlns.jcp.org/jsf/html</span><span class="ST5">&quot;</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">title</span><span class="ST3">&gt;</span>c<span class="ST3">&lt;/</span><span class="ST3">title</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h1</span><span class="ST3">&gt;</span>Success! You are on C!<span class="ST3">&lt;/</span><span class="ST3">h1</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:commandLink</span> <span class="ST4">value</span><span class="ST4">=</span><span class="ST5">&quot;try to go to vitory&quot;</span> <span class="ST4">action</span><span class="ST4">=</span><span class="ST5">&#39;</span><span class="expression-language">#{</span><span class="expression-language">Navigator</span><span class="expression-language">.</span><span class="expression-language">determine</span><span class="expression-language">(</span><span class="ST6">&quot;c&quot;</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST5">&#39;</span><span class="ST3">/</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">html</span><span class="ST3">&gt;</span>
</pre></body>
</html>

@ -0,0 +1,40 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>defeat.xhtml</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.highlight-caret-row {background-color: #323232}
.ST0 {color: #628fb5}
.ST2 {color: #287bde}
.ST5 {color: #a5c261}
.ST3 {color: #e8bf6a}
.ST1 {color: #505050}
.ST4 {color: #bababa}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 3/Assignments/MP2_Navigation_CalebFontenot/src/main/webapp/defeat.xhtml</td></tr></table>
<pre>
<span class="highlight-caret-row">&lt;?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39; ?&gt;</span>
<span class="ST0">&lt;!DOCTYPE</span> <span class="ST0">html</span> <span class="ST0">PUBLIC</span> <span class="ST0">&quot;-//W3C//DTD</span> <span class="ST0">XHTML</span> <span class="ST0">1.0</span> <span class="ST0">Transitional//EN&quot;</span> <span class="ST0">&quot;</span><span class="ST2">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</span><span class="ST0">&quot;</span><span class="ST0">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">html</span> <span class="ST4">xmlns</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://www.w3.org/1999/xhtml</span><span class="ST5">&quot;</span>
<span class="ST4">xmlns:h</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://xmlns.jcp.org/jsf/html</span><span class="ST5">&quot;</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">title</span><span class="ST3">&gt;</span>Defeat<span class="ST3">&lt;/</span><span class="ST3">title</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h1</span><span class="ST3">&gt;</span>Aww, sorry, you loose 😢<span class="ST3">&lt;/</span><span class="ST3">h1</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:commandLink</span> <span class="ST4">value</span><span class="ST4">=</span><span class="ST5">&quot;Try again?&quot;</span> <span class="ST4">action</span><span class="ST4">=</span><span class="ST5">&quot;a.xhtml&quot;</span><span class="ST3">/</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">html</span><span class="ST3">&gt;</span>
</pre></body>
</html>

@ -0,0 +1,39 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>index.xhtml</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.highlight-caret-row {background-color: #323232}
.ST0 {color: #628fb5}
.ST2 {color: #287bde}
.ST5 {color: #a5c261}
.ST3 {color: #e8bf6a}
.ST1 {color: #505050}
.ST4 {color: #bababa}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 3/Assignments/MP2_Navigation_CalebFontenot/src/main/webapp/index.xhtml</td></tr></table>
<pre>
<span class="highlight-caret-row">&lt;?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39; ?&gt;</span>
<span class="ST0">&lt;!DOCTYPE</span> <span class="ST0">html</span> <span class="ST0">PUBLIC</span> <span class="ST0">&quot;-//W3C//DTD</span> <span class="ST0">XHTML</span> <span class="ST0">1.0</span> <span class="ST0">Transitional//EN&quot;</span> <span class="ST0">&quot;</span><span class="ST2">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</span><span class="ST0">&quot;</span><span class="ST0">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">html</span> <span class="ST4">xmlns</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://www.w3.org/1999/xhtml</span><span class="ST5">&quot;</span>
<span class="ST4">xmlns:h</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://xmlns.jcp.org/jsf/html</span><span class="ST5">&quot;</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">title</span><span class="ST3">&gt;</span>Facelet Title<span class="ST3">&lt;/</span><span class="ST3">title</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:commandLink</span> <span class="ST4">value</span><span class="ST4">=</span><span class="ST5">&quot;Go to a&quot;</span> <span class="ST4">action</span><span class="ST4">=</span><span class="ST5">&quot;a.xhtml&quot;</span><span class="ST3">/</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">html</span><span class="ST3">&gt;</span>
</pre></body>
</html>

@ -0,0 +1,40 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>victory.xhtml</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.highlight-caret-row {background-color: #323232}
.ST0 {color: #628fb5}
.ST2 {color: #287bde}
.ST5 {color: #a5c261}
.ST3 {color: #e8bf6a}
.ST1 {color: #505050}
.ST4 {color: #bababa}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 3/Assignments/MP2_Navigation_CalebFontenot/src/main/webapp/victory.xhtml</td></tr></table>
<pre>
<span class="highlight-caret-row">&lt;?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39; ?&gt;</span>
<span class="ST0">&lt;!DOCTYPE</span> <span class="ST0">html</span> <span class="ST0">PUBLIC</span> <span class="ST0">&quot;-//W3C//DTD</span> <span class="ST0">XHTML</span> <span class="ST0">1.0</span> <span class="ST0">Transitional//EN&quot;</span> <span class="ST0">&quot;</span><span class="ST2">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</span><span class="ST0">&quot;</span><span class="ST0">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">html</span> <span class="ST4">xmlns</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://www.w3.org/1999/xhtml</span><span class="ST5">&quot;</span>
<span class="ST4">xmlns:h</span><span class="ST4">=</span><span class="ST5">&quot;</span><span class="ST2">http://xmlns.jcp.org/jsf/html</span><span class="ST5">&quot;</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">title</span><span class="ST3">&gt;</span>Victory<span class="ST3">&lt;/</span><span class="ST3">title</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:head</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h1</span><span class="ST3">&gt;</span>Victory! 🎉<span class="ST3">&lt;/</span><span class="ST3">h1</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;</span><span class="ST3">h:commandLink</span> <span class="ST4">value</span><span class="ST4">=</span><span class="ST5">&quot;Try again?&quot;</span> <span class="ST4">action</span><span class="ST4">=</span><span class="ST5">&quot;a.xhtml&quot;</span><span class="ST3">/</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:form</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">h:body</span><span class="ST3">&gt;</span>
<span class="ST3">&lt;/</span><span class="ST3">html</span><span class="ST3">&gt;</span>
</pre></body>
</html>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<org-netbeans-modules-projectapi.jsf_2e_language>JSP</org-netbeans-modules-projectapi.jsf_2e_language>
</properties>
</project-shared-configuration>

@ -0,0 +1,77 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.calebfontenot</groupId>
<artifactId>MP2_Navigation_CalebFontenot</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>MP2_Navigation_CalebFontenot-1.0-SNAPSHOT</name>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<jakartaee>10.0.0</jakartaee>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,13 @@
package com.calebfontenot.mp2_navigation_calebfontenot;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;
/**
* Configures Jakarta RESTful Web Services for the application.
* @author Juneau
*/
@ApplicationPath("resources")
public class JakartaRestConfiguration extends Application {
}

@ -0,0 +1,20 @@
package com.calebfontenot.mp2_navigation_calebfontenot.resources;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
/**
*
* @author
*/
@Path("jakartaee10")
public class JakartaEE10Resource {
@GET
public Response ping(){
return Response
.ok("ping Jakarta EE")
.build();
}
}

@ -0,0 +1,55 @@
package edu.slcc.asdv.pojo;
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
*/
import jakarta.inject.Named;
import jakarta.enterprise.context.RequestScoped;
/**
*
* @author caleb
*/
@Named(value = "Navigator")
@RequestScoped
public class Navigator {
/**
* Creates a new instance of Navigator
*/
public Navigator() {
}
public String determine(String origin) {
int rand = (int) (Math.random() * 2);
System.out.println(rand);
String returnValue = "";
switch (origin) {
case "a":
if (rand == 0) {
returnValue = "b.xhtml";
} else {
returnValue = "defeat.xhtml";
}
break;
case "b":
if (rand == 0) {
returnValue = "c.xhtml";
} else {
returnValue = "defeat.xhtml";
}
break;
case "c":
if (rand == 0) {
returnValue = "victory.xhtml";
} else {
returnValue = "defeat.xhtml";
}
break;
}
System.out.println("Return value: " + returnValue);
return returnValue;
}
}

@ -0,0 +1,14 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>a</title>
</h:head>
<h:body>
<h1>You are on A.</h1>
<h:form>
<h:commandLink value="try to go to b" action='#{Navigator.determine("a")}'/>
</h:form>
</h:body>
</html>

@ -0,0 +1,14 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>b</title>
</h:head>
<h:body>
<h1>Success! You are on B!</h1>
<h:form>
<h:commandLink value="try to go to c" action='#{Navigator.determine("b")}'/>
</h:form>
</h:body>
</html>

@ -0,0 +1,14 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>c</title>
</h:head>
<h:body>
<h1>Success! You are on C!</h1>
<h:form>
<h:commandLink value="try to go to vitory" action='#{Navigator.determine("c")}'/>
</h:form>
</h:body>
</html>

@ -0,0 +1,14 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>Defeat</title>
</h:head>
<h:body>
<h1>Aww, sorry, you loose 😢</h1>
<h:form>
<h:commandLink value="Try again?" action="a.xhtml"/>
</h:form>
</h:body>
</html>

@ -0,0 +1,13 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form>
<h:commandLink value="Go to a" action="a.xhtml"/>
</h:form>
</h:body>
</html>

@ -0,0 +1,14 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>Victory</title>
</h:head>
<h:body>
<h1>Victory! 🎉</h1>
<h:form>
<h:commandLink value="Try again?" action="a.xhtml"/>
</h:form>
</h:body>
</html>

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<netbeans.hint.jdkPlatform>JDK_11__System_</netbeans.hint.jdkPlatform>
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
</properties>
</project-shared-configuration>

@ -0,0 +1,13 @@
package edu.slcc.asdv.caleb.quizbuslogic;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;
/**
* Configures Jakarta RESTful Web Services for the application.
* @author Juneau
*/
@ApplicationPath("resources")
public class JakartaRestConfiguration extends Application {
}

@ -0,0 +1,20 @@
package edu.slcc.asdv.caleb.quizbuslogic.resources;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
/**
*
* @author
*/
@Path("jakartaee10")
public class JakartaEE10Resource {
@GET
public Response ping(){
return Response
.ok("ping Jakarta EE")
.build();
}
}

@ -0,0 +1,29 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/J2EE/EJB30/StatefulEjbClass.java to edit this template
*/
package ejb;
import jakarta.ejb.Stateful;
import java.util.ArrayList;
/**
*
* @author caleb
*/
@Stateful
public class TestEJB implements TestEJBLocal {
// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")
@Override
public ArrayList<String> getDataFromDatabase()
{
ArrayList<String> l = new ArrayList<String>();
l.add("data from the database");
l.add("suppliers table");
return l;
}
}

@ -0,0 +1,19 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/J2EE/EJB30/SessionLocal.java to edit this template
*/
package ejb;
import jakarta.ejb.Local;
import java.util.ArrayList;
/**
*
* @author caleb
*/
@Local
public interface TestEJBLocal {
public ArrayList<String> getDataFromDatabase();
}

@ -0,0 +1,11 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h3>Testing Locale Changed<h3>
</h:body>
</html>

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>de</supported-locale>
<supported-locale>es</supported-locale>
</locale-config>
<resource-bundle>
<base-name>messages.messages</base-name>
<var>msgs</var>
</resource-bundle>
</application>
</faces-config>

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
</web-app>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.calebfontenot</groupId>
<artifactId>SwingTest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<exec.mainClass>com.calebfontenot.swingtest.SwingTest</exec.mainClass>
</properties>
</project>

@ -0,0 +1,28 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package com.calebfontenot.swingtest;
import javax.swing.*;
/**
*
* @author caleb
*/
// Hello.java (Java SE 8)
public class SwingTest extends JFrame{
public SwingTest() {
super("Hello World");
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
add(new JLabel("Hello, world!"));
pack();
setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(SwingTest::new);
}
}

Some files were not shown because too many files have changed in this diff Show More