Mr. Markou you stress me out so freaking much
7
.gitignore
vendored
@ -67,3 +67,10 @@
|
|||||||
/Semester 2/Exams/ProgrammingExam1Question5/target/
|
/Semester 2/Exams/ProgrammingExam1Question5/target/
|
||||||
/Semester 2/Assignments/suppliers_parts_old/target/
|
/Semester 2/Assignments/suppliers_parts_old/target/
|
||||||
/Semester 2/Assignments/SuppliersPartsDatabase_old/target/
|
/Semester 2/Assignments/SuppliersPartsDatabase_old/target/
|
||||||
|
/Semester 2/Assignments/SupplierPartsCalendar/target/
|
||||||
|
/Semester 2/Assignments/suppliers_parts_calendar/target/
|
||||||
|
/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/target/
|
||||||
|
/Semester 2/Assignments/LabEvents_CalebFontenot/target/
|
||||||
|
/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/target/
|
||||||
|
/Semester 2/Assignments/EventsLabValueChangeListener/target/
|
||||||
|
/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/target/
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scene Scope="Project" version="2">
|
||||||
|
<Scope Scope="Faces Configuration Only"/>
|
||||||
|
<Scope Scope="Project"/>
|
||||||
|
<Scope Scope="All Faces Configurations"/>
|
||||||
|
</Scene>
|
@ -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>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<netbeans.hint.jdkPlatform>JDK_11__System_</netbeans.hint.jdkPlatform>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
83
Semester 2/Assignments/EventsLabValueChangeListener/pom.xml
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<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>asdv</groupId>
|
||||||
|
<artifactId>EventsLabValueChangeListener</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>EventsLabValueChangeListener-1</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>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>13.0.2</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</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 asdv.eventslabvaluechangelistener;
|
||||||
|
|
||||||
|
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 asdv.eventslabvaluechangelistener.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,20 @@
|
|||||||
|
package edu.slcc;
|
||||||
|
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import jakarta.faces.event.AbortProcessingException;
|
||||||
|
import jakarta.faces.event.ValueChangeEvent;
|
||||||
|
import jakarta.faces.event.ValueChangeListener;
|
||||||
|
|
||||||
|
|
||||||
|
public class TextListener implements ValueChangeListener
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void processValueChange(ValueChangeEvent event)
|
||||||
|
throws AbortProcessingException
|
||||||
|
{
|
||||||
|
//FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
Object o = event.getNewValue();
|
||||||
|
String s = o.toString();
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package edu.slcc;
|
||||||
|
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import jakarta.faces.event.AbortProcessingException;
|
||||||
|
import jakarta.faces.event.ValueChangeEvent;
|
||||||
|
import jakarta.faces.event.ValueChangeListener;
|
||||||
|
|
||||||
|
|
||||||
|
public class TextListener1 implements ValueChangeListener
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void processValueChange(ValueChangeEvent event)
|
||||||
|
throws AbortProcessingException
|
||||||
|
{
|
||||||
|
//FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
Object o = event.getNewValue();
|
||||||
|
String s = o.toString();
|
||||||
|
System.out.println(s+ " 888" + "second listener called");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
package edu.slcc;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import jakarta.faces.event.ValueChangeEvent;
|
||||||
|
|
||||||
|
@Named(value = "vst")
|
||||||
|
@SessionScoped
|
||||||
|
public class ValueChangedTestBean implements Serializable
|
||||||
|
{
|
||||||
|
private String name;
|
||||||
|
private String language = "en";
|
||||||
|
private Map<String, String> languagesMap;
|
||||||
|
|
||||||
|
public ValueChangedTestBean()
|
||||||
|
{
|
||||||
|
languagesMap = new LinkedHashMap<String, String>();
|
||||||
|
languagesMap.put("US", "en");//usa
|
||||||
|
languagesMap.put("ES", "es");//spain
|
||||||
|
languagesMap.put("GR", "el");//greece
|
||||||
|
languagesMap.put("RU", "ru");//russia
|
||||||
|
languagesMap.put("CN", "zn");//china
|
||||||
|
languagesMap.put("VI", "vi");//vietnam
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage()
|
||||||
|
{
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language)
|
||||||
|
{
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getLanguagesMap()
|
||||||
|
{
|
||||||
|
List<String> list = Arrays.asList("en", "gr", "es", "ru", "zn", "vi");
|
||||||
|
return languagesMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getLanguages()
|
||||||
|
{
|
||||||
|
List<String> list = Arrays.asList("en", "gr", "es", "ru", "zn", "vi");
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
public void inputTextValueChangeListener( ValueChangeEvent event )
|
||||||
|
{
|
||||||
|
Object o = event.getNewValue();
|
||||||
|
String s = o.toString();
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
public void languageChanged(ValueChangeEvent event)
|
||||||
|
{
|
||||||
|
FacesContext contextInstance = FacesContext.getCurrentInstance();
|
||||||
|
for (Map.Entry<String, String> entry : this.languagesMap.entrySet())
|
||||||
|
{
|
||||||
|
Object o = event.getNewValue();
|
||||||
|
String lang = entry.getValue();
|
||||||
|
if (lang.equals(o.toString()))
|
||||||
|
{
|
||||||
|
contextInstance.getViewRoot().setLocale(
|
||||||
|
new Locale(o.toString(), entry.getKey()));
|
||||||
|
this.language = o.toString();
|
||||||
|
name = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//contextInstance.renderResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String newData()
|
||||||
|
{
|
||||||
|
if (name == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "<p style=\"color:green\">Data in <br />"
|
||||||
|
+ "Your name: " + name + "<br />"
|
||||||
|
+ "Your language: " + language + "<br />"
|
||||||
|
+ "</p>";
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -0,0 +1,4 @@
|
|||||||
|
indexWindowTitle=Immediate
|
||||||
|
txtLang=Your language is English.
|
||||||
|
txtName=Your name:
|
||||||
|
txtEmptyName=The name cannot be empty!
|
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
indexWindowTitle=\u1f0c\u03bc\u03b5\u03c3\u03c9\u03c2
|
||||||
|
txtLang=\u1f29 \u03b3\u03bb\u1ff6\u03c3\u03c3\u03b1 \u03c3\u03b1\u03c2 \u03b5\u1f36\u03bd\u03b1\u03b9 \u1f19\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac.
|
||||||
|
txtName=\u03a4\u03cc \u1f44\u03bd\u03bf\u03bc\u03ac \u03c3\u03b1\u03c2 \u03b5\u1f36\u03bd\u03b1\u03b9:
|
||||||
|
txtEmptyName=\u03a4\u03cc \u1f44\u03bd\u03bf\u03bc\u03ac \u03b4\u03ac\u03bd \u03bc\u03c0\u03bf\u03c1\u03b5\u1fd6 \u03bd\u03ac \u03b5\u1f36\u03bd\u03b1\u03b9 \u1f04\u03b4\u03b5\u03b9\u03bf!
|
@ -0,0 +1,3 @@
|
|||||||
|
txtLang=Your language is English.
|
||||||
|
txtName=Your name:
|
||||||
|
txtEmptyName=The name cannot be empty!
|
@ -0,0 +1,4 @@
|
|||||||
|
indexWindowTitle=Inmediato
|
||||||
|
txtLang=Tu idioma es el ingl\u00e9s.
|
||||||
|
txtName=Su nombre:
|
||||||
|
txtEmptyName=\u00a1El nombre no puede estar vac\u00edo!
|
@ -0,0 +1,4 @@
|
|||||||
|
indexWindowTitle=\u041d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e
|
||||||
|
txtLang=\u0412\u0430\u0448 \u044f\u0437\u044b\u043a \u2014 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439.
|
||||||
|
txtName=\u0412\u0430\u0448\u0435 \u0438\u043c\u044f:
|
||||||
|
txtEmptyName = \u0418\u043c\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c!
|
@ -0,0 +1,4 @@
|
|||||||
|
indexWindowTitle=Ngay l\u1eadp t\u1ee9c
|
||||||
|
txtLang=Ng\u00f4n ng\u1eef c\u1ee7a b\u1ea1n l\u00e0 ti\u1ebfng Vi\u1ec7t.
|
||||||
|
txtName=T\u00ean b\u1ea1n l\u00e0:
|
||||||
|
txtEmptyName=T\u00ean kh\u00f4ng \u0111\u01b0\u1ee3c \u0111\u1ec3 tr\u1ed1ng!
|
@ -0,0 +1,4 @@
|
|||||||
|
indexWindowTitle=\u7acb\u5373
|
||||||
|
txtLang=\u4f60\u7684\u8bed\u8a00\u662f\u4fc4\u8bed\u3002
|
||||||
|
txtName=\u4f60\u7684\u540d\u5b57\u662f:
|
||||||
|
txtEmptyName=\u8be5\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a!
|
@ -0,0 +1,48 @@
|
|||||||
|
<?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"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
<h:head>
|
||||||
|
<h:outputStylesheet library="css" name="styles.css"/>
|
||||||
|
<title>#{msgs.indexWindowTitle}</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h1>#{msgs.indexWindowTitle}</h1>
|
||||||
|
|
||||||
|
<h:form>
|
||||||
|
<p:panelGrid columns="2">
|
||||||
|
<p:outputLabel value="#{msgs.txtName}" ></p:outputLabel>
|
||||||
|
<p:inputText value="#{vst.name}" size="10"
|
||||||
|
required="true"
|
||||||
|
onchange="submit()"
|
||||||
|
requiredMessage="#{msgs.txtEmptyName}"
|
||||||
|
>
|
||||||
|
<f:valueChangeListener type="edu.slcc.TextListener"/>
|
||||||
|
<f:valueChangeListener type="edu.slcc.TextListener1"/>
|
||||||
|
|
||||||
|
</p:inputText >
|
||||||
|
|
||||||
|
<p:outputLabel value="#{msgs.txtLang}"></p:outputLabel>
|
||||||
|
|
||||||
|
<p:selectOneMenu
|
||||||
|
value="#{vst.language}" onchange="submit()"
|
||||||
|
immediate="true"
|
||||||
|
valueChangeListener="#{vst.languageChanged}">
|
||||||
|
<f:selectItems value="#{vst.languagesMap}"/>
|
||||||
|
</p:selectOneMenu>
|
||||||
|
|
||||||
|
</p:panelGrid>
|
||||||
|
<p:commandButton value="Submit" />
|
||||||
|
|
||||||
|
<p:outputLabel escape="false"
|
||||||
|
value="#{vst.newData()}" />
|
||||||
|
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
<?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"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||||
|
|
||||||
|
<h:head>
|
||||||
|
<h:outputStylesheet library="css" name="styles.css"/>
|
||||||
|
<title>#{msgs.indexWindowTitle}</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h1>#{msgs.indexWindowTitle}</h1>
|
||||||
|
|
||||||
|
<h:form>
|
||||||
|
<h:panelGrid columns="2">
|
||||||
|
<h:outputLabel value="#{msgs.txtName}" ></h:outputLabel>
|
||||||
|
<h:inputText value="#{vst.name}" size="10"
|
||||||
|
required="true"
|
||||||
|
onchange="submit()"
|
||||||
|
requiredMessage="#{msgs.txtEmptyName}"
|
||||||
|
>
|
||||||
|
<f:valueChangeListener type="edu.slcc.TextListener"/>
|
||||||
|
<f:valueChangeListener type="edu.slcc.TextListener1"/>
|
||||||
|
|
||||||
|
</h:inputText >
|
||||||
|
|
||||||
|
<h:outputLabel value="#{msgs.txtLang}"></h:outputLabel>
|
||||||
|
|
||||||
|
<h:selectOneMenu
|
||||||
|
value="#{vst.language}" onchange="submit()"
|
||||||
|
immediate="true"
|
||||||
|
valueChangeListener="#{vst.languageChanged}">
|
||||||
|
<f:selectItems value="#{vst.languagesMap}"/>
|
||||||
|
</h:selectOneMenu>
|
||||||
|
|
||||||
|
</h:panelGrid>
|
||||||
|
<h:commandButton value="Submit" />
|
||||||
|
|
||||||
|
<h:outputText escape="false"
|
||||||
|
value="#{vst.newData()}" />
|
||||||
|
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,45 @@
|
|||||||
|
<?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"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||||
|
|
||||||
|
<h:head>
|
||||||
|
<h:outputStylesheet library="css" name="styles.css"/>
|
||||||
|
<title>#{msgs.indexWindowTitle}</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h1>#{msgs.indexWindowTitle}</h1>
|
||||||
|
|
||||||
|
<h:form>
|
||||||
|
<h:panelGrid columns="2">
|
||||||
|
<h:outputLabel value="#{msgs.txtName}" ></h:outputLabel>
|
||||||
|
<h:inputText value="#{vst.name}" size="10"
|
||||||
|
required="true"
|
||||||
|
onchange="submit()"
|
||||||
|
requiredMessage="#{msgs.txtEmptyName}"
|
||||||
|
valueChangeListener ="#{vst.inputTextValueChangeListener}"
|
||||||
|
>
|
||||||
|
</h:inputText >
|
||||||
|
|
||||||
|
<h:outputLabel value="#{msgs.txtLang}"></h:outputLabel>
|
||||||
|
|
||||||
|
<h:selectOneMenu
|
||||||
|
value="#{vst.language}" onchange="submit()"
|
||||||
|
immediate="true"
|
||||||
|
valueChangeListener="#{vst.languageChanged}">
|
||||||
|
<f:selectItems value="#{vst.languagesMap}"/>
|
||||||
|
</h:selectOneMenu>
|
||||||
|
|
||||||
|
</h:panelGrid>
|
||||||
|
<h:commandButton value="Submit" />
|
||||||
|
|
||||||
|
<h:outputText escape="false"
|
||||||
|
value="#{vst.newData()}" />
|
||||||
|
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -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>
|
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
|
||||||
|
<faces-config version="4.0"
|
||||||
|
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/web-facesconfig_4_0.xsd">
|
||||||
|
|
||||||
|
<application>
|
||||||
|
<resource-bundle>
|
||||||
|
<base-name>messages.messages</base-name>
|
||||||
|
<var>msgs</var>
|
||||||
|
</resource-bundle>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
|
||||||
|
</faces-config>
|
@ -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>
|
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" 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/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/1-value-change-listener-primefaces.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,3 @@
|
|||||||
|
.columns {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 191 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 528 B |
After Width: | Height: | Size: 4.9 KiB |
@ -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>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<netbeans.hint.jdkPlatform>JDK_11__System_</netbeans.hint.jdkPlatform>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
@ -0,0 +1,42 @@
|
|||||||
|
<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>EventsLabValueChangeListener_CalebFontenot</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>EventsLabValueChangeListener_CalebFontenot-1.0-SNAPSHOT</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<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>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import jakarta.faces.event.AbortProcessingException;
|
||||||
|
import jakarta.faces.event.ValueChangeEvent;
|
||||||
|
import jakarta.faces.event.ValueChangeListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
public class TextListener implements ValueChangeListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processValueChange(ValueChangeEvent event) throws AbortProcessingException
|
||||||
|
{
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
Object o = event.getNewValue();
|
||||||
|
String s = o.toString();
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import jakarta.faces.event.AbortProcessingException;
|
||||||
|
import jakarta.faces.event.ValueChangeEvent;
|
||||||
|
import jakarta.faces.event.ValueChangeListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
public class TextListener1 implements ValueChangeListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processValueChange(ValueChangeEvent event) throws AbortProcessingException
|
||||||
|
{
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
Object o = event.getNewValue();
|
||||||
|
String s = o.toString();
|
||||||
|
System.out.println(s + " a second listener was called");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,101 @@
|
|||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import jakarta.faces.event.AbortProcessingException;
|
||||||
|
import jakarta.faces.event.ValueChangeEvent;
|
||||||
|
|
||||||
|
@Named(value = "vst")
|
||||||
|
@SessionScoped
|
||||||
|
public class ValueChangedTestBean implements Serializable
|
||||||
|
{
|
||||||
|
private String name;
|
||||||
|
private String language = "en";
|
||||||
|
private Map<String, String> languagesMap;
|
||||||
|
|
||||||
|
public ValueChangedTestBean()
|
||||||
|
{
|
||||||
|
languagesMap = new LinkedHashMap<String, String>();
|
||||||
|
languagesMap.put("US", "en");//usa
|
||||||
|
languagesMap.put("ES", "es");//spain
|
||||||
|
languagesMap.put("GR", "el");//greece
|
||||||
|
languagesMap.put("RU", "ru");//russia
|
||||||
|
languagesMap.put("CN", "zn");//china
|
||||||
|
languagesMap.put("VI", "vi");//vietnam
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage()
|
||||||
|
{
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language)
|
||||||
|
{
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getLanguagesMap()
|
||||||
|
{
|
||||||
|
List<String> list = Arrays.asList("en", "gr", "es", "ru", "zn", "vi");
|
||||||
|
return languagesMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getLanguages()
|
||||||
|
{
|
||||||
|
List<String> list = Arrays.asList("en", "gr", "es", "ru", "zn", "vi");
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
public void inputTextValueChangeListener(ValueChangeEvent event) throws AbortProcessingException {
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
Object o = event.getNewValue();
|
||||||
|
String s = o.toString();
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
public void languageChanged(ValueChangeEvent event)
|
||||||
|
{
|
||||||
|
FacesContext contextInstance = FacesContext.getCurrentInstance();
|
||||||
|
for (Map.Entry<String, String> entry : this.languagesMap.entrySet())
|
||||||
|
{
|
||||||
|
Object o = event.getNewValue();
|
||||||
|
String lang = entry.getValue();
|
||||||
|
if (lang.equals(o.toString()))
|
||||||
|
{
|
||||||
|
contextInstance.getViewRoot().setLocale(
|
||||||
|
new Locale(o.toString(), entry.getKey()));
|
||||||
|
this.language = o.toString();
|
||||||
|
name = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
contextInstance.renderResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String newData()
|
||||||
|
{
|
||||||
|
if (name == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "<p style=\"color:green\">Data in <br />"
|
||||||
|
+ "Your name: " + name + "<br />"
|
||||||
|
+ "Your language: " + language + "<br />"
|
||||||
|
+ "</p>";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package edu.slcc.asdv.caleb.eventslabvaluechangelistener_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 edu.slcc.asdv.caleb.eventslabvaluechangelistener_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,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>
|
@ -0,0 +1,4 @@
|
|||||||
|
indexWindowTitle=Immediate
|
||||||
|
txtLang=Your language is English.
|
||||||
|
txtName=Your name:
|
||||||
|
txtEmptyName=The name cannot be empty!
|
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
indexWindowTitle=\u1f0c\u03bc\u03b5\u03c3\u03c9\u03c2
|
||||||
|
txtLang=\u1f29 \u03b3\u03bb\u1ff6\u03c3\u03c3\u03b1 \u03c3\u03b1\u03c2 \u03b5\u1f36\u03bd\u03b1\u03b9 \u1f19\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac.
|
||||||
|
txtName=\u03a4\u03cc \u1f44\u03bd\u03bf\u03bc\u03ac \u03c3\u03b1\u03c2 \u03b5\u1f36\u03bd\u03b1\u03b9:
|
||||||
|
txtEmptyName=\u03a4\u03cc \u1f44\u03bd\u03bf\u03bc\u03ac \u03b4\u03ac\u03bd \u03bc\u03c0\u03bf\u03c1\u03b5\u1fd6 \u03bd\u03ac \u03b5\u1f36\u03bd\u03b1\u03b9 \u1f04\u03b4\u03b5\u03b9\u03bf!
|
@ -0,0 +1,3 @@
|
|||||||
|
txtLang=Your language is English.
|
||||||
|
txtName=Your name:
|
||||||
|
txtEmptyName=The name cannot be empty!
|
@ -0,0 +1,4 @@
|
|||||||
|
indexWindowTitle=Inmediato
|
||||||
|
txtLang=Tu idioma es el ingl\u00e9s.
|
||||||
|
txtName=Su nombre:
|
||||||
|
txtEmptyName=\u00a1El nombre no puede estar vac\u00edo!
|
@ -0,0 +1,4 @@
|
|||||||
|
indexWindowTitle=\u041d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e
|
||||||
|
txtLang=\u0412\u0430\u0448 \u044f\u0437\u044b\u043a \u2014 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439.
|
||||||
|
txtName=\u0412\u0430\u0448\u0435 \u0438\u043c\u044f:
|
||||||
|
txtEmptyName = \u0418\u043c\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c!
|
@ -0,0 +1,4 @@
|
|||||||
|
indexWindowTitle=Ngay l\u1eadp t\u1ee9c
|
||||||
|
txtLang=Ng\u00f4n ng\u1eef c\u1ee7a b\u1ea1n l\u00e0 ti\u1ebfng Vi\u1ec7t.
|
||||||
|
txtName=T\u00ean b\u1ea1n l\u00e0:
|
||||||
|
txtEmptyName=T\u00ean kh\u00f4ng \u0111\u01b0\u1ee3c \u0111\u1ec3 tr\u1ed1ng!
|
@ -0,0 +1,4 @@
|
|||||||
|
indexWindowTitle=\u7acb\u5373
|
||||||
|
txtLang=\u4f60\u7684\u8bed\u8a00\u662f\u4fc4\u8bed\u3002
|
||||||
|
txtName=\u4f60\u7684\u540d\u5b57\u662f:
|
||||||
|
txtEmptyName=\u8be5\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a!
|
@ -0,0 +1,46 @@
|
|||||||
|
<?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"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||||
|
|
||||||
|
<h:head>
|
||||||
|
<h:outputStylesheet library="css" name="styles.css"/>
|
||||||
|
<title>#{msgs.indexWindowTitle}</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h1>#{msgs.indexWindowTitle}</h1>
|
||||||
|
|
||||||
|
<h:form>
|
||||||
|
<h:panelGrid columns="2">
|
||||||
|
<h:outputLabel value="#{msgs.txtName}" ></h:outputLabel>
|
||||||
|
<h:inputText value="#{vst.name}" size="10"
|
||||||
|
required="true"
|
||||||
|
onchange="submit()"
|
||||||
|
requiredMessage="#{msgs.txtEmptyName}"
|
||||||
|
valueChangeListener="vst.inputTextValueChangeListener"
|
||||||
|
>
|
||||||
|
<f:valueChangeListener type="beans.TextListener"/>
|
||||||
|
<f:valueChangeListener type="beans.TextListener1"/>
|
||||||
|
</h:inputText >
|
||||||
|
|
||||||
|
<h:outputLabel value="#{msgs.txtLang}"></h:outputLabel>
|
||||||
|
|
||||||
|
<h:selectOneMenu
|
||||||
|
value="#{vst.language}" onchange="submit()"
|
||||||
|
immediate="true"
|
||||||
|
valueChangeListener="#{vst.languageChanged}">
|
||||||
|
<f:selectItems value="#{vst.languagesMap}"/>
|
||||||
|
</h:selectOneMenu>
|
||||||
|
|
||||||
|
</h:panelGrid>
|
||||||
|
<h:commandButton value="Submit" />
|
||||||
|
|
||||||
|
<h:outputText escape="false"
|
||||||
|
value="#{vst.newData()}" />
|
||||||
|
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
|
||||||
|
</html>
|
@ -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>
|
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<faces-config version="4.0"
|
||||||
|
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/web-facesconfig_4_0.xsd">
|
||||||
|
<application>
|
||||||
|
<resource-bundle>
|
||||||
|
<base-name>messages.messages</base-name>
|
||||||
|
<var>msgs</var>
|
||||||
|
</resource-bundle>
|
||||||
|
</application>
|
||||||
|
</faces-config>
|
@ -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>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="5.0" 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/web-app_5_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/1-value-change-listener.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/css.css to edit this template
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Created on : Nov 13, 2023, 10:07:11 AM
|
||||||
|
Author : caleb
|
||||||
|
*/
|
||||||
|
|
||||||
|
.normalSize { font-size: 110% }
|
||||||
|
.largeSize { font-size: 200% }
|
||||||
|
body {
|
||||||
|
background-color: #e9e9e9;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: red
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,h2,h3 {
|
||||||
|
text-align: center;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button1
|
||||||
|
{
|
||||||
|
text-height:font-size;
|
||||||
|
}
|
@ -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>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<netbeans.hint.jdkPlatform>JDK_11__System_</netbeans.hint.jdkPlatform>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
@ -0,0 +1,52 @@
|
|||||||
|
<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>JavaScriptValidation_CalebFontenot</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>JavaScriptValidation_CalebFontenot-1.0-SNAPSHOT</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.protobuf</groupId>
|
||||||
|
<artifactId>protobuf-java</artifactId>
|
||||||
|
<version>3.21.9</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>10.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>12.0.0</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</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>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.RequestScoped;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
@Named(value="controlRender")
|
||||||
|
@RequestScoped
|
||||||
|
public class ControlRender {
|
||||||
|
|
||||||
|
private String text;
|
||||||
|
private String mask;
|
||||||
|
private int rate;
|
||||||
|
private String userName;
|
||||||
|
private String alpha;
|
||||||
|
|
||||||
|
public String getAlpha()
|
||||||
|
{
|
||||||
|
return alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlpha(String alpha)
|
||||||
|
{
|
||||||
|
this.alpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getUserName()
|
||||||
|
{
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName)
|
||||||
|
{
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value of rate
|
||||||
|
*
|
||||||
|
* @return the value of rate
|
||||||
|
*/
|
||||||
|
public int getRate()
|
||||||
|
{
|
||||||
|
return rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of rate
|
||||||
|
*
|
||||||
|
* @param rate new value of rate
|
||||||
|
*/
|
||||||
|
public void setRate(int rate)
|
||||||
|
{
|
||||||
|
this.rate = rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value of mask
|
||||||
|
*
|
||||||
|
* @return the value of mask
|
||||||
|
*/
|
||||||
|
public String getMask()
|
||||||
|
{
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of mask
|
||||||
|
*
|
||||||
|
* @param mask new value of mask
|
||||||
|
*/
|
||||||
|
public void setMask(String mask)
|
||||||
|
{
|
||||||
|
this.mask = mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getText()
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text)
|
||||||
|
{
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void printToServer() {
|
||||||
|
System.out.println(this.text);
|
||||||
|
System.out.println(this.mask);
|
||||||
|
System.out.println(this.rate);
|
||||||
|
System.out.println(this.userName);
|
||||||
|
System.out.println(this.alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates a new instance of ControlRender */
|
||||||
|
public ControlRender() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package edu.slcc.asdv.caleb.javascriptvalidation_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 edu.slcc.asdv.caleb.javascriptvalidation_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,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>
|
@ -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>
|
@ -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>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="5.0" 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/web-app_5_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,39 @@
|
|||||||
|
<?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"
|
||||||
|
|
||||||
|
xmlns:p="http://primefaces.org/ui"> <h:head>
|
||||||
|
<h:outputScript library="js" name="do_validation.js"/>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h1>Validation with javascript and primefaces</h1>
|
||||||
|
<br/>
|
||||||
|
<h:form>
|
||||||
|
alphanumeric input only javascript called:
|
||||||
|
<h:inputText id="id2" value="#{controlRender.text}"
|
||||||
|
onkeyup="validateText('submitFormId:id2')"/>
|
||||||
|
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
only letters and numbers regex:
|
||||||
|
<p:inputMask title="type in name, only alphanumeric characters (I'm looking at you, Elon Musk)." value="#{controlRender.userName}">
|
||||||
|
<p:keyFilter regEx="/[A-Za-z0-9]/"/>
|
||||||
|
</p:inputMask>
|
||||||
|
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
only numbers mask:
|
||||||
|
<p:inputMask value="#{controlRender.mask}" mask="99-(999) 999-9999"/>
|
||||||
|
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
only letters mask:
|
||||||
|
<p:inputMask value="#{controlRender.mask}" mask="aaa"/>
|
||||||
|
<br/><br/>
|
||||||
|
rate: <p:rating value="#{controlRender.rate}"/>
|
||||||
|
<p:commandButton value="submit" action="#{controlRender.printToServer}"/>
|
||||||
|
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/JavaScript.js to edit this template
|
||||||
|
*/
|
||||||
|
function validateText(textInputID)
|
||||||
|
{
|
||||||
|
var htmlInputText = document.getElementById(textInputID);
|
||||||
|
var text = htmlInputText.value;
|
||||||
|
|
||||||
|
|
||||||
|
var regex = /[^A-Za-z0-9]/g;
|
||||||
|
|
||||||
|
if (text.search( regex) != -1)
|
||||||
|
{
|
||||||
|
newText = text.replace(regex, "");
|
||||||
|
htmlInputText.value = newText;
|
||||||
|
alert("alphanumeric chars only please");
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
@ -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>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
42
Semester 2/Assignments/LabEvents_CalebFontenot/pom.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<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>LabEvents_CalebFontenot</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>LabEvents_CalebFontenot-1.0-SNAPSHOT</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<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>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import jakarta.faces.event.ActionEvent;
|
||||||
|
|
||||||
|
@Named(value = "formSettings")
|
||||||
|
@SessionScoped
|
||||||
|
public class FormSettings implements Serializable
|
||||||
|
{
|
||||||
|
private boolean isNormalSize = true;
|
||||||
|
|
||||||
|
public String getBodyStyleClass()
|
||||||
|
{
|
||||||
|
if (isNormalSize) return ("normalSize");//css class
|
||||||
|
else return ("largeSize");
|
||||||
|
}
|
||||||
|
public void setNormalSize(ActionEvent event){
|
||||||
|
System.out.println("****************************setNormalSize called");
|
||||||
|
isNormalSize = true;}
|
||||||
|
public void setLargeSize(ActionEvent event){
|
||||||
|
System.out.println(
|
||||||
|
"**************************************setLargeSize called");
|
||||||
|
isNormalSize = false;}
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import jakarta.faces.event.ActionEvent;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Named(value = "formSettingsLocale")
|
||||||
|
@SessionScoped
|
||||||
|
public class FormSettingsLocale implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
private boolean isNormalSize = true;
|
||||||
|
private boolean isEnglish = true;
|
||||||
|
private static final Locale ENGLISH = new Locale("en");
|
||||||
|
private static final Locale SPANISH = new Locale("es");
|
||||||
|
private static final Locale JAPANESE = new Locale("jp");
|
||||||
|
private static final Locale GREEK = new Locale("el");
|
||||||
|
|
||||||
|
private Locale locale = ENGLISH;
|
||||||
|
private String language = locale.getLanguage();
|
||||||
|
|
||||||
|
private static final Map<String, String> LANGUAGE_MAP
|
||||||
|
= new LinkedHashMap<>();
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
LANGUAGE_MAP.put("English", "en");
|
||||||
|
LANGUAGE_MAP.put("Español", "es");
|
||||||
|
LANGUAGE_MAP.put("日本人", "jp");
|
||||||
|
LANGUAGE_MAP.put(" Ἑλληνικά", "el");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBodyStyleClass()
|
||||||
|
{
|
||||||
|
if (isNormalSize)
|
||||||
|
{
|
||||||
|
return ("normalSize");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ("largeSize");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNormalSize(ActionEvent event)
|
||||||
|
{
|
||||||
|
isNormalSize = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLargeSize(ActionEvent event)
|
||||||
|
{
|
||||||
|
isNormalSize = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Locale getLocale()
|
||||||
|
{
|
||||||
|
return (locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swapLocale( ActionEvent event )
|
||||||
|
{
|
||||||
|
isEnglish = !isEnglish;
|
||||||
|
if (isEnglish)
|
||||||
|
{
|
||||||
|
locale = ENGLISH;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
locale = SPANISH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage()
|
||||||
|
{
|
||||||
|
return (language);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language)
|
||||||
|
{
|
||||||
|
this.language = language;
|
||||||
|
locale = new Locale(language);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getLanguages()
|
||||||
|
{
|
||||||
|
return (LANGUAGE_MAP);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.RequestScoped;
|
||||||
|
|
||||||
|
@Named(value = "person")
|
||||||
|
@RequestScoped
|
||||||
|
public class Person {
|
||||||
|
|
||||||
|
private String firstName, lastName, emailAddress;
|
||||||
|
|
||||||
|
public String getFirstName()
|
||||||
|
{
|
||||||
|
return firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstName(String firstName)
|
||||||
|
{
|
||||||
|
System.out.println("---------------------------------------first name called");
|
||||||
|
this.firstName = firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastName()
|
||||||
|
{
|
||||||
|
return lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastName(String lastName)
|
||||||
|
{
|
||||||
|
this.lastName = lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmailAddress()
|
||||||
|
{
|
||||||
|
return emailAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmailAddress(String emailAddress)
|
||||||
|
{
|
||||||
|
this.emailAddress = emailAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String doRegistration()
|
||||||
|
{
|
||||||
|
if (isAnyEmpty(firstName, lastName, emailAddress)) {
|
||||||
|
return "missing-input";
|
||||||
|
} else {
|
||||||
|
return "confirm-registration";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAnyEmpty(String... values)
|
||||||
|
{
|
||||||
|
for (String value : values) {
|
||||||
|
if (isEmpty(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isEmpty(String value)
|
||||||
|
{
|
||||||
|
return value == null || value.trim().length() == 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package edu.slcc.asdv.caleb.labevents_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 edu.slcc.asdv.caleb.labevents_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,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>
|
@ -0,0 +1,14 @@
|
|||||||
|
registrationTitle=Registration
|
||||||
|
firstName=First Name
|
||||||
|
lastName=Last Name
|
||||||
|
emailAddress=Email Address
|
||||||
|
registrationText=Please Enter Your {0}, {1}, and {2}.
|
||||||
|
prompt=Enter {0}
|
||||||
|
buttonLabel=Register Me
|
||||||
|
successTitle=Success
|
||||||
|
successText=You Registered Successfully.
|
||||||
|
switchLanguage=En Español
|
||||||
|
normalFont=Normal Font
|
||||||
|
largeFont=Large Font
|
||||||
|
errorTitle=Error!
|
||||||
|
missingData=Missing input. Please try again.
|
@ -0,0 +1,14 @@
|
|||||||
|
registrationTitle=\u1f18\u03b3\u03b3\u03c1\u03b1\u03c6\u03ae
|
||||||
|
firstName= \u1f4c\u03bd\u03bf\u03bc\u03b1
|
||||||
|
lastName=\u1f18\u03c0\u03c9\u03bd\u03c5\u03bc\u03bf\u03bd
|
||||||
|
emailAddress=\u1f38\u03bc\u03ad\u03b9\u03bb
|
||||||
|
registrationText=\u03a0\u03b1\u03c1\u03b1\u03ba\u03b1\u03bb\u1ff6 \u03b3\u03c1\u03ac\u03c8\u03b1\u03c4\u03b5 {0}, {1}, \u03ba\u03b1\u1f30 {2}.
|
||||||
|
prompt=\u0393\u03c1\u03ac\u03c8\u03b5 {0}
|
||||||
|
buttonLabel=\u1f18\u03b3\u03b3\u03c1\u03ac\u03c8\u03b5 \u03bc\u03b5
|
||||||
|
successTitle=\u1f18\u03c0\u03b9\u03c4\u03c5\u03c7\u03af\u03b1
|
||||||
|
successText=\u0393\u03c1\u03ac\u03c6\u03c4\u03b7\u03ba\u03b5\u03c2
|
||||||
|
switchLanguage=\u03a3\u03c4\u03ac \u1f19\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac
|
||||||
|
normalFont=\u039c\u03b9\u03ba\u03c1\u03ac \u03b3\u03c1\u03ac\u03bc\u03bc\u03b1\u03c4\u03b1
|
||||||
|
largeFont=\u039c\u03b5\u03b3\u03ac\u03bb\u03b1 \u03b3\u03c1\u03ac\u03bc\u03bc\u03b1\u03c4\u03b1
|
||||||
|
errorTitle=\u039b\u03ac\u03b8\u03bf\u03c2!
|
||||||
|
missingData=\u1f18\u03bb\u03bb\u03b5\u03b9\u03c0\u1f20 \u03c3\u03c4\u03bf\u03b9\u03c7\u03b5\u1fd6\u03b1. \u03a0\u03b1\u03c1\u03b1\u03ba\u03b1\u03bb\u1ff6 \u03be\u03b1\u03bd\u03b1\u03b4\u03bf\u03ba\u03b9\u03bc\u1fb6\u03c3\u03c4\u03b5!
|
@ -0,0 +1,14 @@
|
|||||||
|
registrationTitle=Registro
|
||||||
|
firstName=Primer Nombre
|
||||||
|
lastName=Apellido
|
||||||
|
emailAddress=Dirección de Email
|
||||||
|
registrationText=Incorpore Por Favor su {0}, {1}, y {2}.
|
||||||
|
prompt=Incorpore {0}
|
||||||
|
buttonLabel=Coloqúeme
|
||||||
|
successTitle=Éxito
|
||||||
|
successText=Se Registró con Éxito.
|
||||||
|
switchLanguage=In English
|
||||||
|
normalFont=Fuente Normal
|
||||||
|
largeFont=Fuente Grande
|
||||||
|
errorTitle=¡Error!
|
||||||
|
missingData=Falta de input. Por favor, inténtelo de nuevo.
|
@ -0,0 +1,14 @@
|
|||||||
|
registrationTitle=\u767B\u9332
|
||||||
|
firstName=\u540D\u524D
|
||||||
|
lastName=\u59D3
|
||||||
|
emailAddress=\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9
|
||||||
|
registrationText=\u3042\u306A\u305F\u306E\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044 {0}, {1}, \u3068 {2}.
|
||||||
|
prompt=\u30BF\u30A4\u30D7 {0}
|
||||||
|
buttonLabel=\u79C1\u3092\u767B\u9332
|
||||||
|
successTitle=\u6210\u529F
|
||||||
|
successText=\u3042\u306A\u305F\u304C\u6B63\u5E38\u306B\u767B\u9332\u3002
|
||||||
|
switchLanguage=\u65E5\u672C\u8A9E\u3067
|
||||||
|
normalFont=\u901A\u5E38\u306E\u30D5\u30A9\u30F3\u30C8
|
||||||
|
largeFont=\u5927\u304D\u3044\u30D5\u30A9\u30F3\u30C8
|
||||||
|
errorTitle=\u30A8\u30E9\u30FC\uFF01
|
||||||
|
missingData=\u672A\u5165\u529B\u3067\u3059\u3002\u3082\u3046\u4E00\u5EA6\u3084\u308A\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
@ -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>
|
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<faces-config version="4.0"
|
||||||
|
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/web-facesconfig_4_0.xsd">
|
||||||
|
<application>
|
||||||
|
<resource-bundle>
|
||||||
|
<base-name>messages.messages</base-name>
|
||||||
|
<var>msgs</var>
|
||||||
|
</resource-bundle>
|
||||||
|
</application>
|
||||||
|
</faces-config>
|
@ -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>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="5.0" 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/web-app_5_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,21 @@
|
|||||||
|
<!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://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
|
||||||
|
<h:head><title>#{msgs.successTitle}</title>
|
||||||
|
<h:outputStylesheet library="css" name="styles.css"/>
|
||||||
|
|
||||||
|
</h:head>
|
||||||
|
|
||||||
|
<h:body styleClass="#{formSettings.bodyStyleClass}">
|
||||||
|
<h1 class="title">#{msgs.successTitle}</h1>
|
||||||
|
<h3>#{msgs.successText}</h3>
|
||||||
|
<ul>
|
||||||
|
<li>#{msgs.firstName}: #{person.firstName}</li>
|
||||||
|
<li>#{msgs.lastName}: #{person.lastName}</li>
|
||||||
|
<li>#{msgs.emailAddress}: #{person.emailAddress}</li>
|
||||||
|
</ul>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,19 @@
|
|||||||
|
<?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="jakarta.faces.html">
|
||||||
|
<h:head>
|
||||||
|
<title>Events</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h3>Handling Application Events</h3>
|
||||||
|
<h:form>
|
||||||
|
<h:commandLink value="change font size via buttons 1" action="register1"/>
|
||||||
|
<br/>
|
||||||
|
<h:commandLink value="change lovale via buttons 2" action="register2"/>
|
||||||
|
<br/>
|
||||||
|
<h:commandLink value="change locale via radio buttons 3" action="register3"/>
|
||||||
|
<br/>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,52 @@
|
|||||||
|
<!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://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
<h:head><title>#{msgs.registrationTitle}</title>
|
||||||
|
<h:outputStylesheet library="css" name="styles.css"/>
|
||||||
|
|
||||||
|
</h:head>
|
||||||
|
|
||||||
|
<h:body styleClass="#{formSettings.bodyStyleClass}">
|
||||||
|
|
||||||
|
<h1 > #{msgs.registrationTitle}</h1>
|
||||||
|
<h3>
|
||||||
|
<h:outputFormat value="#{msgs.registrationText}">
|
||||||
|
<f:param value="#{msgs.firstName}"/>
|
||||||
|
<f:param value="#{msgs.lastName}"/>
|
||||||
|
<f:param value="#{msgs.emailAddress}"/>
|
||||||
|
</h:outputFormat>
|
||||||
|
</h3>
|
||||||
|
<h:form>
|
||||||
|
<h:panelGrid columns="2" >
|
||||||
|
|
||||||
|
<h:outputLabel value="#{msgs.firstName}"/>
|
||||||
|
<h:inputText value="#{person.firstName}" />
|
||||||
|
|
||||||
|
|
||||||
|
<h:outputLabel value="#{msgs.lastName}" />
|
||||||
|
<h:inputText value="#{person.lastName}" />
|
||||||
|
|
||||||
|
<h:outputLabel value="#{msgs.emailAddress}"/>
|
||||||
|
<h:inputText value="#{person.emailAddress}" />
|
||||||
|
|
||||||
|
<h:commandButton value="#{msgs.buttonLabel}"
|
||||||
|
action="#{person.doRegistration}"/>
|
||||||
|
</h:panelGrid>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h:commandButton value="#{msgs.normalFont}"
|
||||||
|
actionListener="#{formSettings.setNormalSize}"
|
||||||
|
immediate="true"/>
|
||||||
|
|
||||||
|
<h:commandLink value="#{msgs.largeFont}"
|
||||||
|
actionListener="#{formSettings.setLargeSize}"
|
||||||
|
immediate="true"/>
|
||||||
|
<br/>
|
||||||
|
<h:commandButton value="#{msgs.buttonLabel}"
|
||||||
|
action="#{person.doRegistration}"/>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,55 @@
|
|||||||
|
<!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://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
<f:view locale="#{formSettingsLocale.locale}">
|
||||||
|
|
||||||
|
|
||||||
|
<h:head><title>#{msgs.registrationTitle}</title>
|
||||||
|
<h:outputStylesheet library="css" name="styles.css"/>
|
||||||
|
</h:head>
|
||||||
|
<h:body styleClass="#{formSettingsLocale.bodyStyleClass}">
|
||||||
|
<h1 class="title">#{msgs.registrationTitle}</h1>
|
||||||
|
<h3>
|
||||||
|
<h:outputFormat value="#{msgs.registrationText}">
|
||||||
|
<f:param value="#{msgs.firstName}"/>
|
||||||
|
<f:param value="#{msgs.lastName}"/>
|
||||||
|
<f:param value="#{msgs.emailAddress}"/>
|
||||||
|
</h:outputFormat>
|
||||||
|
</h3>
|
||||||
|
<h:form>
|
||||||
|
<h:panelGrid columns="2" >
|
||||||
|
|
||||||
|
<h:outputLabel value="#{msgs.firstName}"/>
|
||||||
|
<h:inputText value="#{person.firstName}" />
|
||||||
|
|
||||||
|
|
||||||
|
<h:outputLabel value="#{msgs.lastName}" />
|
||||||
|
<h:inputText value="#{person.lastName}" />
|
||||||
|
|
||||||
|
<h:outputLabel value="#{msgs.emailAddress}"/>
|
||||||
|
<h:inputText value="#{person.emailAddress}" />
|
||||||
|
<h:commandButton value="#{msgs.buttonLabel}"
|
||||||
|
action="#{person.doRegistration}"/>
|
||||||
|
|
||||||
|
</h:panelGrid>
|
||||||
|
<br/>
|
||||||
|
<div align="center">
|
||||||
|
<h:commandButton value="#{msgs.normalFont}"
|
||||||
|
actionListener="#{formSettingsLocale.setNormalSize}"
|
||||||
|
immediate="true"/>
|
||||||
|
<h:commandButton value="#{msgs.largeFont}"
|
||||||
|
actionListener="#{formSettingsLocale.setLargeSize}"
|
||||||
|
immediate="true"/>
|
||||||
|
<br/>
|
||||||
|
<h:selectOneRadio value="#{formSettingsLocale.language}"
|
||||||
|
onclick="submit()"
|
||||||
|
>
|
||||||
|
<f:selectItems value="#{formSettingsLocale.languages}"/>
|
||||||
|
</h:selectOneRadio>
|
||||||
|
</div>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</f:view>
|
||||||
|
</html>
|
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/css.css to edit this template
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Created on : Nov 13, 2023, 10:07:11 AM
|
||||||
|
Author : caleb
|
||||||
|
*/
|
||||||
|
|
||||||
|
.normalSize { font-size: 110% }
|
||||||
|
.largeSize { font-size: 200% }
|
||||||
|
body {
|
||||||
|
background-color: #e9e9e9;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: red
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,h2,h3 {
|
||||||
|
text-align: center;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button1
|
||||||
|
{
|
||||||
|
text-height:font-size;
|
||||||
|
}
|
@ -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>9.0-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>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<netbeans.hint.jdkPlatform>JDK_11__System_</netbeans.hint.jdkPlatform>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
87
Semester 2/Assignments/SupplierPartsCalendar/pom.xml
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<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.mycompany</groupId>
|
||||||
|
<artifactId>SuppliersPartsCalendar</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>SuppliersPartsCalendar</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
<jakartaee>9.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<version>8.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>12.0.0</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>10.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</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.mycompany.supplierspartsdatabase;
|
||||||
|
|
||||||
|
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.mycompany.supplierspartsdatabase.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee9")
|
||||||
|
public class JakartaEE9Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.beans;
|
||||||
|
|
||||||
|
import edu.slcc.asdv.bl.DBase;
|
||||||
|
import edu.slcc.asdv.bl.part.DatabaseManipulationPart;
|
||||||
|
import edu.slcc.asdv.bl.part.Part;
|
||||||
|
import edu.slcc.asdv.bl.supplier.DatabaseManipulationSupplier;
|
||||||
|
import edu.slcc.asdv.bl.supplier.Supplier;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import jakarta.faces.application.FacesMessage;
|
||||||
|
import jakarta.faces.application.FacesMessage.Severity;
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named(value = "supplierBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class SupplierBean implements Serializable {
|
||||||
|
|
||||||
|
//DBase dms;
|
||||||
|
//DBase dmp;
|
||||||
|
DBase dms = new DatabaseManipulationSupplier();
|
||||||
|
DBase dmp = new DatabaseManipulationPart();
|
||||||
|
List<Supplier> suppliers;
|
||||||
|
List<Part> parts;
|
||||||
|
|
||||||
|
private Supplier selectedSupplier;
|
||||||
|
|
||||||
|
public Supplier getSelectedSupplier() {
|
||||||
|
return selectedSupplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedSupplier(Supplier selectedSupplier) {
|
||||||
|
this.selectedSupplier = selectedSupplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SupplierBean() {
|
||||||
|
suppliers = dms.listAll();
|
||||||
|
parts = dmp.listAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Supplier> getSuppliers() {
|
||||||
|
return suppliers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Part> getParts() {
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteFromList() {
|
||||||
|
int totalRowsUpdated = 0;
|
||||||
|
Iterator<Supplier> iterator = this.suppliers.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Supplier s = iterator.next();
|
||||||
|
if (s.isModify()) {
|
||||||
|
try {
|
||||||
|
int rowsUpdated = this.dms.delete(s);
|
||||||
|
if (rowsUpdated > 0) {
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = ("Numbers of rows updated is 0.");
|
||||||
|
addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void saveFromUpdate() {
|
||||||
|
int totalRowsUpdated = 0;
|
||||||
|
for (Supplier s : this.suppliers) {
|
||||||
|
if (s.isModify()) {
|
||||||
|
try {
|
||||||
|
int rowsUpdated = this.dms.update(s);
|
||||||
|
if (rowsUpdated > 0) {
|
||||||
|
totalRowsUpdated += rowsUpdated;
|
||||||
|
s.setModify(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = ("Numbers of rows updated is 0.");
|
||||||
|
addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String msg = ("Numbers of rows updated: " + totalRowsUpdated);
|
||||||
|
addMessage(msg, "no exception", FacesMessage.SEVERITY_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveFromUpdatePart() {
|
||||||
|
int totalRowsUpdated = 0;
|
||||||
|
|
||||||
|
for (Part s : this.parts) {
|
||||||
|
if (s.isModify()) {
|
||||||
|
try {
|
||||||
|
int rowsUpdated = this.dmp.update(s);
|
||||||
|
if (rowsUpdated > 0) {
|
||||||
|
totalRowsUpdated += rowsUpdated;
|
||||||
|
s.setModify(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = ("Numbers of rows updated is 0.");
|
||||||
|
addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String msg = ("Numbers of rows updated: " + totalRowsUpdated);
|
||||||
|
addMessage(msg, "no exception", FacesMessage.SEVERITY_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMessage(String summary, String detail, Severity severity) {
|
||||||
|
FacesMessage msg = new FacesMessage(severity, summary, detail);
|
||||||
|
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
try {
|
||||||
|
//suppliers.dms.listAll();
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.bl;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
public interface DBase<T>
|
||||||
|
{
|
||||||
|
List<T> listAll();
|
||||||
|
|
||||||
|
int update( T t)
|
||||||
|
throws SQLException;
|
||||||
|
|
||||||
|
int delete(T t)
|
||||||
|
throws SQLException;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.bl;
|
||||||
|
|
||||||
|
import jakarta.faces.application.FacesMessage;
|
||||||
|
import jakarta.faces.component.UIComponent;
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import jakarta.faces.validator.FacesValidator;
|
||||||
|
import jakarta.faces.validator.Validator;
|
||||||
|
import jakarta.faces.validator.ValidatorException;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
@FacesValidator("dateValidator")
|
||||||
|
public class DateValidator implements Validator<String> {
|
||||||
|
|
||||||
|
private static final String DATE_PATTERN = "yyyy-MM-dd";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(FacesContext context, UIComponent component, String value) throws ValidatorException {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN);
|
||||||
|
sdf.setLenient(false);
|
||||||
|
try {
|
||||||
|
sdf.parse(value);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Invalid date format", "Date must be in 'yyyy-MM-dd' format"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.bl;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
public class UtilitiesDatabase
|
||||||
|
{
|
||||||
|
public Connection connection(
|
||||||
|
String databaseName,
|
||||||
|
String userName,
|
||||||
|
String password,
|
||||||
|
String URL2
|
||||||
|
|
||||||
|
) //throws InstantiationException, IllegalAccessException
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
String databaseName = "suppliers_parts_23";
|
||||||
|
String userName = "root";
|
||||||
|
String password = "root";
|
||||||
|
String URL2 = "com.mysql.jdbc.Driver";
|
||||||
|
Connection con = null;
|
||||||
|
*/
|
||||||
|
Connection con;
|
||||||
|
try
|
||||||
|
{// Load Sun's jdbc driver
|
||||||
|
Class.forName(URL2).newInstance();
|
||||||
|
System.out.println("JDBC Driver loaded!");
|
||||||
|
}
|
||||||
|
catch (Exception e) // driver not found
|
||||||
|
{
|
||||||
|
System.err.println("Unable to load database driver");
|
||||||
|
System.err.println("Details : " + e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String ip = "localhost"; //internet connection
|
||||||
|
String url = "jdbc:mysql://" + ip + ":3306/" + databaseName + "?allowPublicKeyRetrieval=true&useSSL=false";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
con = DriverManager.getConnection(url, userName, password);
|
||||||
|
con.setReadOnly(false);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.err.println(e.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
System.out.println("connection successfull");
|
||||||
|
return con;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void closeDatabaseConnection( Connection con)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (con != null)
|
||||||
|
{
|
||||||
|
con.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
System.out.println(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static java.sql.Date stringDateToSqlDate(String sDate)
|
||||||
|
{
|
||||||
|
java.util.Date date = null;
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
date = sdf.parse(sDate);
|
||||||
|
}
|
||||||
|
catch (ParseException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return new java.sql.Date( date.getTime() );
|
||||||
|
|
||||||
|
}
|
||||||
|
//public static java {
|
||||||
|
// java.sqlDate sqldate = stringDateToSqlDate();
|
||||||
|
//}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.bl.part;
|
||||||
|
|
||||||
|
import edu.slcc.asdv.bl.DBase;
|
||||||
|
import edu.slcc.asdv.bl.UtilitiesDatabase;
|
||||||
|
import edu.slcc.asdv.bl.supplier.Supplier;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
public class DatabaseManipulationPart implements DBase<Part>
|
||||||
|
{
|
||||||
|
private static final String DATABASE_NAME = "suppliers_parts_23";
|
||||||
|
private static final String USER_NAME = "java";
|
||||||
|
private static final String PASSWORD = "8VCS49HT2xjsEZvC";
|
||||||
|
private static final String DRIVER_URL = "com.mysql.jdbc.Driver";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Part> listAll() {
|
||||||
|
List<Part> tablePart = new ArrayList<>();
|
||||||
|
String sqlStr = "SELECT * FROM part";
|
||||||
|
try (Connection con = new UtilitiesDatabase().connection(DATABASE_NAME, USER_NAME, PASSWORD, DRIVER_URL);
|
||||||
|
PreparedStatement ps = con.prepareStatement(sqlStr);
|
||||||
|
ResultSet rs = ps.executeQuery()) {
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
String pNumber = rs.getString(1);
|
||||||
|
String pName = rs.getString(2);
|
||||||
|
String color = rs.getString(3);
|
||||||
|
String city = rs.getString(4);
|
||||||
|
Part part = new Part(pNumber, pName, color, city);
|
||||||
|
tablePart.add(part);
|
||||||
|
}
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
throw new RuntimeException("Error fetching parts from database", ex);
|
||||||
|
}
|
||||||
|
return tablePart;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int update(Part part) throws SQLException {
|
||||||
|
String sqlStr = "UPDATE part SET pname=?, color=?, city=? WHERE pnumber=?";
|
||||||
|
try (Connection con = new UtilitiesDatabase().connection(DATABASE_NAME, USER_NAME, PASSWORD, DRIVER_URL);
|
||||||
|
PreparedStatement ps = con.prepareStatement(sqlStr)) {
|
||||||
|
|
||||||
|
ps.setString(1, part.getPname());
|
||||||
|
ps.setString(2, part.getColor());
|
||||||
|
ps.setString(3, part.getCity());
|
||||||
|
ps.setString(4, part.getPnumber());
|
||||||
|
return ps.executeUpdate();
|
||||||
|
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
throw new RuntimeException("Error updating part in database", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delete(Part t) throws SQLException {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
}
|