MP hell MP hell MP hell MP hell

This commit is contained in:
2023-09-08 21:14:06 -05:00
parent f3d65894e2
commit 204f9db501
177 changed files with 1326 additions and 0 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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);
}

View File

@@ -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;
}
}
}

View File

@@ -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 {
}

View File

@@ -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();
}
}

View File

@@ -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;
}
}

View File

@@ -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();
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
<!-- Define Persistence Unit -->
<persistence-unit name="my_persistence_unit">
</persistence-unit>
</persistence>

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
bean-discovery-mode="all">
</beans>

View File

@@ -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>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
-->
<!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">
<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>

View File

@@ -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>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>Start Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>

View File

@@ -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>