Markou moment
@@ -0,0 +1,19 @@
 | 
			
		||||
<?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>
 | 
			
		||||
    </properties>
 | 
			
		||||
</project-shared-configuration>
 | 
			
		||||
@@ -0,0 +1,48 @@
 | 
			
		||||
<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>Ajax6_getters_setters_CalebFontenot</artifactId>
 | 
			
		||||
    <version>1.0-SNAPSHOT</version>
 | 
			
		||||
    <packaging>war</packaging>
 | 
			
		||||
    <name>Ajax6_getters_setters_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>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.primefaces</groupId>
 | 
			
		||||
            <artifactId>primefaces</artifactId>
 | 
			
		||||
            <version>13.0.4</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,71 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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;
 | 
			
		||||
import jakarta.faces.event.AbortProcessingException;
 | 
			
		||||
import jakarta.faces.event.AjaxBehaviorEvent;
 | 
			
		||||
import jakarta.faces.view.ViewScoped;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * @author asdv5
 | 
			
		||||
 */
 | 
			
		||||
@Named(value = "testBean1")
 | 
			
		||||
@ViewScoped 
 | 
			
		||||
public class TestBean1 implements Serializable
 | 
			
		||||
{
 | 
			
		||||
    public TestBean1()
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println(" -----------------------constructor TestBean1()------------------");
 | 
			
		||||
    }
 | 
			
		||||
    private String x;
 | 
			
		||||
    private String y;
 | 
			
		||||
 | 
			
		||||
    public String getX()
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println(" getX() " + x);
 | 
			
		||||
        return x;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setX(String x)
 | 
			
		||||
    {
 | 
			
		||||
        this.x = x;
 | 
			
		||||
        System.out.println(" setX() " + x);
 | 
			
		||||
        this.x += " x " + x;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String gety()
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println(" getY() " + y);
 | 
			
		||||
        return y;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setY(String y)
 | 
			
		||||
    {
 | 
			
		||||
        this.y = y;
 | 
			
		||||
        System.out.println(" setY() " + y);
 | 
			
		||||
        this.y += " y " + y;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void toUpperCase(AjaxBehaviorEvent event)
 | 
			
		||||
            throws AbortProcessingException
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println("-------- ajaxListener()-------");
 | 
			
		||||
        if (this.x != null)
 | 
			
		||||
        {
 | 
			
		||||
            System.out.println(" ajaxListener() IF x " + x);
 | 
			
		||||
            this.x = this.x.toUpperCase();
 | 
			
		||||
        }
 | 
			
		||||
        if (this.y != null)
 | 
			
		||||
        {
 | 
			
		||||
            System.out.println(" ajaxListener() IF y " + y);
 | 
			
		||||
            this.y = this.y.toUpperCase();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
package edu.slcc.asdv.caleb.ajax6_getters_setters_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.ajax6_getters_setters_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="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/index.xhtml</welcome-file>
 | 
			
		||||
    </welcome-file-list>
 | 
			
		||||
</web-app>
 | 
			
		||||
@@ -0,0 +1,68 @@
 | 
			
		||||
<?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:f5="http://xmlns.jcp.org/jsf/passthrough"
 | 
			
		||||
      xmlns:p="http://primefaces.org/ui"
 | 
			
		||||
      xmlns:f="http://xmlns.jcp.org/jsf/core">
 | 
			
		||||
    <h:head>
 | 
			
		||||
        <title>Facelet Title</title>
 | 
			
		||||
    </h:head>
 | 
			
		||||
    <h:body>
 | 
			
		||||
        <h:form>
 | 
			
		||||
            <h:panelGrid columns="2" cellpadding="10">
 | 
			
		||||
                <p:inputText id="id_x"
 | 
			
		||||
                             value="#{testBean1.x}" 
 | 
			
		||||
                             required="required" title="x"
 | 
			
		||||
                             f5:placeholder="type something"
 | 
			
		||||
                             />
 | 
			
		||||
                <p:inputText id="id_y"
 | 
			
		||||
                             value="#{testBean1.y}" 
 | 
			
		||||
                             required="required" title="y"
 | 
			
		||||
                             f5:placeholder="type something else"
 | 
			
		||||
                             />
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                Prime Ajax tag: PROCESSes id_x UPDATEs id_x only. Ajax Listener will not be called
 | 
			
		||||
                 when we use PROCESS in the tag
 | 
			
		||||
                <p:commandButton value="PROCESS id_x UPDATE id_x ">
 | 
			
		||||
                    <p:ajax process="id_x" update="id_x" 
 | 
			
		||||
                            
 | 
			
		||||
                            />
 | 
			
		||||
                </p:commandButton>
 | 
			
		||||
                
 | 
			
		||||
                    Prime Ajax tag: when you use listener, the listener is executed before the setters.
 | 
			
		||||
                    So, do not use PROCESS  when you use listener.
 | 
			
		||||
                    If you use PROCESS the listener is not called.
 | 
			
		||||
                    
 | 
			
		||||
                <p:commandButton value="if use Ajax LISTENER never use PROCESS attribute">
 | 
			
		||||
                    <p:ajax    update="id_y" 
 | 
			
		||||
                            listener="#{testBean1.toUpperCase}"/>
 | 
			
		||||
                </p:commandButton>             
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    
 | 
			
		||||
 JSF Ajax PROCESSes id_x UPDATEs id_x only. Ajax Listener will not be called
 | 
			
		||||
                 when we use EXECUTE in the tag
 | 
			
		||||
                <h:commandButton value="f:ajax PROCESS id_x UPDATE id_x ">
 | 
			
		||||
                    <f:ajax execute="id_x" render="id_x" />
 | 
			
		||||
                </h:commandButton>
 | 
			
		||||
                
 | 
			
		||||
                    JSF Ajax tag: when you use listener, the listener is executed before the setters.
 | 
			
		||||
                    So, do not use EXECUTE  when you use listener.
 | 
			
		||||
                    If you use EXECUTE the listener is not called.
 | 
			
		||||
                    
 | 
			
		||||
                <h:commandButton value="if use Ajax LISTENER never use PROCESS attribute">
 | 
			
		||||
                    <f:ajax    render="id_y" 
 | 
			
		||||
                            listener="#{testBean1.toUpperCase}"/>
 | 
			
		||||
                </h:commandButton>             
 | 
			
		||||
                
 | 
			
		||||
                    
 | 
			
		||||
                    
 | 
			
		||||
                    
 | 
			
		||||
                    
 | 
			
		||||
            </h:panelGrid>
 | 
			
		||||
        </h:form>
 | 
			
		||||
    </h:body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,18 @@
 | 
			
		||||
<?xml version='1.0' encoding='UTF-8' ?>
 | 
			
		||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 | 
			
		||||
<html xmlns="http://www.w3.org/1999/xhtml"
 | 
			
		||||
      xmlns:h="http://xmlns.jcp.org/jsf/html">
 | 
			
		||||
    <h:head>
 | 
			
		||||
        <title>Ajax 6</title>
 | 
			
		||||
    </h:head>
 | 
			
		||||
    <h:body>
 | 
			
		||||
        <h:form>
 | 
			
		||||
            <h:panelGrid columns="1" cellpadding="10">
 | 
			
		||||
                
 | 
			
		||||
            <h:commandLink value="test commandButton to send-form" action="send-form-buttons"/>
 | 
			
		||||
                        <h:commandLink value="Ajax Listener test commandButton to send-form" action="ajax-listener-send-form-buttons"/>
 | 
			
		||||
 | 
			
		||||
            </h:panelGrid >
 | 
			
		||||
        </h:form>
 | 
			
		||||
    </h:body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,37 @@
 | 
			
		||||
<?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:f5="http://xmlns.jcp.org/jsf/passthrough"
 | 
			
		||||
      xmlns:p="http://primefaces.org/ui">
 | 
			
		||||
    <h:head>
 | 
			
		||||
        <title>Facelet Title</title>
 | 
			
		||||
    </h:head>
 | 
			
		||||
    <h:body>
 | 
			
		||||
        <h:form>
 | 
			
		||||
            <h:panelGrid columns="2" cellpadding="10">
 | 
			
		||||
                <p:inputText id="x1"
 | 
			
		||||
                             value="#{testBean1.x}" 
 | 
			
		||||
                             required="required" title="x"
 | 
			
		||||
                             f5:placeholder="type something"
 | 
			
		||||
                             />
 | 
			
		||||
                <p:inputText id="y1"
 | 
			
		||||
                             value="#{testBean1.y}" 
 | 
			
		||||
                             required="required" title="y"
 | 
			
		||||
                             f5:placeholder="type something else"
 | 
			
		||||
                             />
 | 
			
		||||
 | 
			
		||||
               
 | 
			
		||||
                calls  setters ONLY, it DOES NOT render form
 | 
			
		||||
                <p:commandButton value="send form Ajax true"/>
 | 
			
		||||
                
 | 
			
		||||
                calls  setters then getters, it DOES RENDER form
 | 
			
		||||
                <p:commandButton ajax="false" value="send form Ajax false"/>
 | 
			
		||||
 | 
			
		||||
                calls  setters then getters, it DOES RENDER form same as ajax="false"
 | 
			
		||||
                <h:commandButton  value="send form JSF commandButton"/>
 | 
			
		||||
 | 
			
		||||
            </h:panelGrid>
 | 
			
		||||
        </h:form>
 | 
			
		||||
    </h:body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -16,5 +16,6 @@ Any value defined here will override the pom.xml file value but is only applicab
 | 
			
		||||
        <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_15__System_</netbeans.hint.jdkPlatform>
 | 
			
		||||
    </properties>
 | 
			
		||||
</project-shared-configuration>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								Semester 3/Assignments/Ajz5/nb-configuration.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -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_15__System_</netbeans.hint.jdkPlatform>
 | 
			
		||||
    </properties>
 | 
			
		||||
</project-shared-configuration>
 | 
			
		||||
							
								
								
									
										83
									
								
								Semester 3/Assignments/Ajz5/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>5</artifactId>
 | 
			
		||||
    <version>1</version>
 | 
			
		||||
    <packaging>war</packaging>
 | 
			
		||||
    <name>Ajax5-1-Many</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,20 @@
 | 
			
		||||
package asdv.ajax.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,276 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 model.factoryOneToMany.OneToMany;
 | 
			
		||||
import model.factoryOneToMany.OneToManyFactory;
 | 
			
		||||
import jakarta.faces.event.AbortProcessingException;
 | 
			
		||||
import jakarta.faces.event.AjaxBehaviorEvent;
 | 
			
		||||
import jakarta.faces.view.ViewScoped;
 | 
			
		||||
import jakarta.inject.Named;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@Named
 | 
			
		||||
@ViewScoped
 | 
			
		||||
public class PartialProcessingBean implements Serializable
 | 
			
		||||
{
 | 
			
		||||
    private String country;
 | 
			
		||||
    private String city;
 | 
			
		||||
    private String[] countries =
 | 
			
		||||
    {
 | 
			
		||||
        "USA", "Greece", "France"
 | 
			
		||||
    };
 | 
			
		||||
    private String[] citiesFrance =
 | 
			
		||||
    {
 | 
			
		||||
        "Paris", "Marseille"
 | 
			
		||||
    };
 | 
			
		||||
    private String[] citiesGreece =
 | 
			
		||||
    {
 | 
			
		||||
        "Athens", "Sparta"
 | 
			
		||||
    };
 | 
			
		||||
    private String[] citiesUsa =
 | 
			
		||||
    {
 | 
			
		||||
        "Lafayette", "New Orleans"
 | 
			
		||||
    };
 | 
			
		||||
    private OneToMany oneToMany = OneToManyFactory.createOneToMany();
 | 
			
		||||
    private String name = "";
 | 
			
		||||
    private String totalValue = "120.00";
 | 
			
		||||
    private String email = "";
 | 
			
		||||
    private String emailAgain = "";
 | 
			
		||||
    private Date date;
 | 
			
		||||
    private String tickets = "1";
 | 
			
		||||
    private String price = "120";
 | 
			
		||||
    private Map<String, Object> ticketAttrs;
 | 
			
		||||
    private Map<String, Object> priceAttrs;
 | 
			
		||||
 | 
			
		||||
    public PartialProcessingBean()
 | 
			
		||||
    {
 | 
			
		||||
        oneToMany.initializeOne(this.countries);
 | 
			
		||||
        oneToMany.initializeMany(this.countries[0], citiesUsa);
 | 
			
		||||
        oneToMany.initializeMany(this.countries[1], citiesGreece);
 | 
			
		||||
        oneToMany.initializeMany(this.countries[2], citiesFrance);
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
        ticketAttrs = new HashMap<>();
 | 
			
		||||
        this.ticketAttrs.put("type", "number");
 | 
			
		||||
        this.ticketAttrs.put("min", "1");
 | 
			
		||||
        this.ticketAttrs.put("max", "4");
 | 
			
		||||
        this.ticketAttrs.put("required", "required");
 | 
			
		||||
        this.ticketAttrs.put("title",
 | 
			
		||||
                "Enter a number between 1 and 4 inclusive.");
 | 
			
		||||
        this.priceAttrs = new HashMap<>();
 | 
			
		||||
        this.priceAttrs.put("type", "number");
 | 
			
		||||
        this.priceAttrs.put("min", "120");
 | 
			
		||||
        this.priceAttrs.put("max", "1000");
 | 
			
		||||
        this.priceAttrs.put("required", "required");
 | 
			
		||||
        this.priceAttrs.put("step", 10);
 | 
			
		||||
        this.priceAttrs.put("title",
 | 
			
		||||
                "Enter a number between 120 and 100 inclusive.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public OneToMany getOneToMany()
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println("getOneToMany()");
 | 
			
		||||
        return oneToMany;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getCountry()
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println("getCountry()");
 | 
			
		||||
        return country;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCountry(String country)
 | 
			
		||||
    {
 | 
			
		||||
         System.out.println("setCountry(String country) " + country );
 | 
			
		||||
        this.country = country;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getCity()
 | 
			
		||||
    {
 | 
			
		||||
        return city;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCity(String city)
 | 
			
		||||
    {
 | 
			
		||||
      System.out.println("setCity(String city) " + city );
 | 
			
		||||
 | 
			
		||||
        this.city = city;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getEmail()
 | 
			
		||||
    {
 | 
			
		||||
        return email;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setEmail(String email)
 | 
			
		||||
    {
 | 
			
		||||
              System.out.println("setEmail(String email) " + city );
 | 
			
		||||
 | 
			
		||||
        this.email = email;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void handleCountryChange()
 | 
			
		||||
    {
 | 
			
		||||
        if (country != null && !country.equals(""))
 | 
			
		||||
        {
 | 
			
		||||
            getMany();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Collection<String> getMany()
 | 
			
		||||
    {
 | 
			
		||||
        if (country != null && !country.equals(""))
 | 
			
		||||
        {
 | 
			
		||||
            return this.oneToMany.getMany(country);
 | 
			
		||||
        }
 | 
			
		||||
        return Arrays.asList(citiesUsa);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getName()
 | 
			
		||||
    {
 | 
			
		||||
        return name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setName(String name)
 | 
			
		||||
    {
 | 
			
		||||
                      System.out.println("setName(String name) " + name );
 | 
			
		||||
 | 
			
		||||
        this.name = name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getTotalValue()
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println("getTotalValue(String totalValue) " );
 | 
			
		||||
        return totalValue;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTotalValue(String totalValue)
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println("setTotalValue(String totalValue) " + totalValue );
 | 
			
		||||
        this.totalValue = totalValue;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getEmailAgain()
 | 
			
		||||
    {
 | 
			
		||||
                System.out.println("getEmailAgain() " );
 | 
			
		||||
 | 
			
		||||
        return emailAgain;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setEmailAgain(String emailAgain)
 | 
			
		||||
    {
 | 
			
		||||
       System.out.println("setEmailAgain(String emailAgain) " + emailAgain );
 | 
			
		||||
 | 
			
		||||
        this.emailAgain = emailAgain;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Date getDate()
 | 
			
		||||
    {
 | 
			
		||||
     System.out.println("getDate() ");
 | 
			
		||||
 | 
			
		||||
        return date;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setDate(Date date)
 | 
			
		||||
    {
 | 
			
		||||
      System.out.println("setDate(Date date) " + date );
 | 
			
		||||
 | 
			
		||||
        this.date = date;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getTickets()
 | 
			
		||||
    {
 | 
			
		||||
      System.out.println("getTickets() " );
 | 
			
		||||
 | 
			
		||||
        return tickets;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTickets(String tickets)
 | 
			
		||||
    {
 | 
			
		||||
      System.out.println("setTickets(String tickets) " + tickets );
 | 
			
		||||
        this.tickets = tickets;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getPrice()
 | 
			
		||||
    {
 | 
			
		||||
              System.out.println("getPrice() " );
 | 
			
		||||
 | 
			
		||||
        return price;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPrice(String price)
 | 
			
		||||
    {
 | 
			
		||||
              System.out.println("setPrice(String price) "  + price);
 | 
			
		||||
 | 
			
		||||
        this.price = price;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Map<String, Object> getTicketAttrs()
 | 
			
		||||
    {
 | 
			
		||||
         System.out.println("getTicketAttrs() " );
 | 
			
		||||
 | 
			
		||||
        return ticketAttrs;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTicketAttrs(Map<String, Object> ticketAttrs)
 | 
			
		||||
    {
 | 
			
		||||
       System.out.println("setTicketAttrs(Map<String, Object> ticketAttrs) "  + ticketAttrs);
 | 
			
		||||
 | 
			
		||||
        this.ticketAttrs = ticketAttrs;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Map<String, Object> getPriceAttrs()
 | 
			
		||||
    {
 | 
			
		||||
               System.out.println("getPriceAttrs() " );
 | 
			
		||||
 | 
			
		||||
        return priceAttrs;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPriceAttrs(Map<String, Object> priceAttrs)
 | 
			
		||||
    {
 | 
			
		||||
               System.out.println("setPriceAttrs(Map<String, Object> priceAttrs) "  + ticketAttrs);
 | 
			
		||||
 | 
			
		||||
        this.priceAttrs = priceAttrs;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void calculateTotal(AjaxBehaviorEvent event)
 | 
			
		||||
            throws AbortProcessingException
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println("calculateTotal(AjaxBehaviorEvent event)");
 | 
			
		||||
        int ticketsNum = 1;
 | 
			
		||||
        int ticketPrice = 0;
 | 
			
		||||
        int total;
 | 
			
		||||
        if (tickets.trim().length() > 0)
 | 
			
		||||
        {
 | 
			
		||||
            ticketsNum = Integer.parseInt(tickets);
 | 
			
		||||
        }
 | 
			
		||||
        if (price.trim().length() > 0)
 | 
			
		||||
        {
 | 
			
		||||
            ticketPrice = Integer.parseInt(price);
 | 
			
		||||
        }
 | 
			
		||||
        total = (ticketsNum * ticketPrice);
 | 
			
		||||
        totalValue = String.valueOf(total) + ".00";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void clear(AjaxBehaviorEvent event)
 | 
			
		||||
            throws AbortProcessingException
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println("clear(AjaxBehaviorEvent event)");
 | 
			
		||||
        name = "";
 | 
			
		||||
        email = "";
 | 
			
		||||
        emailAgain = "";
 | 
			
		||||
        date = null;
 | 
			
		||||
        price = "120.00";
 | 
			
		||||
        totalValue = "120.00";
 | 
			
		||||
        tickets = "1";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,68 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 model.factoryOneToMany;
 | 
			
		||||
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * @author asdv5
 | 
			
		||||
 * @param <One>
 | 
			
		||||
 * @param <Many>
 | 
			
		||||
 */
 | 
			
		||||
public interface OneToMany<One, Many>
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialization of Ones. The method should be used first before any other
 | 
			
		||||
     * methods
 | 
			
		||||
     *
 | 
			
		||||
     * @param one - the ones ( i.e, countries, or SelectItem or any Object) to
 | 
			
		||||
     * use for initialization
 | 
			
		||||
     * @return true if the initialization succeeded by using the method once,
 | 
			
		||||
     * false when the method is used more than once.
 | 
			
		||||
     */
 | 
			
		||||
    boolean initializeOne(One... one);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialization of the many for a given one. The method can be used
 | 
			
		||||
     * multiple times after the method initializeOne has succeeded.
 | 
			
		||||
     *
 | 
			
		||||
     * @param one - the one that has the many
 | 
			
		||||
     * @param many - the many which belong to th eone
 | 
			
		||||
     * @throws IllegalArgumentException when the one does not exist (i.e. user's
 | 
			
		||||
     * typing error for the name of one) or when the initialization of the one
 | 
			
		||||
     * has not occurred.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    void initializeMany(One one, Many... many)
 | 
			
		||||
            throws IllegalArgumentException;
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the many of a specific one.
 | 
			
		||||
     *
 | 
			
		||||
     * @param one the one to get its many
 | 
			
		||||
     * @return the many of the parameter one or null if the one does not exist.
 | 
			
		||||
     */
 | 
			
		||||
    Collection<Many> getMany(One one);
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Given a value of the many it gets the one that the many belongs to.
 | 
			
		||||
     *
 | 
			
		||||
     * @param many one of the values of the many
 | 
			
		||||
     * @return the one
 | 
			
		||||
     */
 | 
			
		||||
    One getOne(Many many);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets a set with all the ones
 | 
			
		||||
     *
 | 
			
		||||
     * @return the set of ones.
 | 
			
		||||
     */
 | 
			
		||||
    Set<One> getAllOnes();
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,204 @@
 | 
			
		||||
package model.factoryOneToMany;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.LinkedHashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
public class OneToManyFactory
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates an object of type OneToMany
 | 
			
		||||
     *
 | 
			
		||||
     * @param <One> a generic parameter can be any object that denotes a One.
 | 
			
		||||
     * @param <Many> a generic parameter can be any object that denotes a city
 | 
			
		||||
     * that belongs to the one generic type.
 | 
			
		||||
     * @return a OneCity object.
 | 
			
		||||
     */
 | 
			
		||||
    public static <One, Many> //generic types to be used in the method
 | 
			
		||||
            OneToMany<One, Many> //rturn type
 | 
			
		||||
            createOneToMany()
 | 
			
		||||
    {
 | 
			
		||||
        return new OneToMany<One, Many>()
 | 
			
		||||
        {
 | 
			
		||||
            private Map<Object, Object> oneToMany = new LinkedHashMap();
 | 
			
		||||
            boolean oneInitialized = false;
 | 
			
		||||
            boolean manyInitialized = false;
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            public boolean initializeOne(One... one)
 | 
			
		||||
            {
 | 
			
		||||
                if (oneInitialized == false && manyInitialized == false)
 | 
			
		||||
                {
 | 
			
		||||
                    for (int i = 0; i < one.length; ++i)
 | 
			
		||||
                    {
 | 
			
		||||
                        oneToMany.put(one[i], new Boolean(true));
 | 
			
		||||
                    }
 | 
			
		||||
                    oneInitialized = true;
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            public void initializeMany(One one, Many... many)
 | 
			
		||||
                    throws IllegalArgumentException
 | 
			
		||||
            {
 | 
			
		||||
                if (oneToMany.get(one) == null)//if the key of the one is null
 | 
			
		||||
                {//the method initializekey has not been used
 | 
			
		||||
                    throw new IllegalArgumentException(one + " is not valid");
 | 
			
		||||
                }
 | 
			
		||||
                oneToMany.put(one, new ArrayList<Many>(Arrays.asList(many)));
 | 
			
		||||
                manyInitialized = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            public Collection<Many> getMany(One one)
 | 
			
		||||
                    throws IllegalArgumentException
 | 
			
		||||
            {
 | 
			
		||||
                if (oneInitialized == true && manyInitialized == true)
 | 
			
		||||
                {
 | 
			
		||||
                    if (oneToMany.get(one) == null)
 | 
			
		||||
                    {
 | 
			
		||||
                        throw new IllegalArgumentException(one + " is not a valid One");
 | 
			
		||||
                    }
 | 
			
		||||
                    Collection c1 = (Collection) oneToMany.get(one);
 | 
			
		||||
                    return c1;
 | 
			
		||||
                }
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            public One getOne(Many many)
 | 
			
		||||
            {
 | 
			
		||||
                Set< Entry<Object, Object>> set = oneToMany.entrySet();
 | 
			
		||||
                for (Map.Entry<Object, Object> entry : oneToMany.entrySet())
 | 
			
		||||
                {
 | 
			
		||||
                    One key = (One) entry.getKey();
 | 
			
		||||
                    Collection<Many> value = (Collection<Many>) oneToMany.get(key);
 | 
			
		||||
                    if (value.contains(many))
 | 
			
		||||
                    {
 | 
			
		||||
                        return key;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            public Set<One> getAllOnes()
 | 
			
		||||
            {
 | 
			
		||||
                return (Set<One>) oneToMany.keySet();
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void main(String[] args)
 | 
			
		||||
    {
 | 
			
		||||
        OneToMany cc = OneToManyFactory.createOneToMany();
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            cc.initializeMany("France", "Paris");
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception e)
 | 
			
		||||
        {
 | 
			
		||||
            System.err.println(e);
 | 
			
		||||
        }
 | 
			
		||||
        boolean b1 = cc.initializeOne("USA", "Greece");
 | 
			
		||||
        System.out.println(b1);
 | 
			
		||||
        boolean b2 = cc.initializeOne("USA", "Greece");
 | 
			
		||||
        System.out.println(b2);
 | 
			
		||||
        cc.initializeMany("USA", "Lafayette", "New Orleans");
 | 
			
		||||
        cc.initializeMany("Greece", "Athens", "Sparta");
 | 
			
		||||
        Collection<String> cities1 = cc.getMany("USA");
 | 
			
		||||
        System.out.println(cities1);
 | 
			
		||||
        Collection<String> cities2 = cc.getMany("Greece");
 | 
			
		||||
        System.out.println(cities2);
 | 
			
		||||
        System.out.println(cc.getOne("Athens"));
 | 
			
		||||
        System.out.println(cc.getOne("Lafayette"));
 | 
			
		||||
        System.out.println(cc.getOne("France"));
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            System.out.println(cc.getMany("Germany"));
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception e)
 | 
			
		||||
        {
 | 
			
		||||
            System.err.println(e);
 | 
			
		||||
        }
 | 
			
		||||
        System.out.println(cc.getAllOnes());
 | 
			
		||||
        System.out.println("--------------------------------------");
 | 
			
		||||
        OneToMany supplierParts = OneToManyFactory.createOneToMany();
 | 
			
		||||
        Supplier s1 = new Supplier("s1");
 | 
			
		||||
        Supplier s2 = new Supplier("s2");
 | 
			
		||||
        supplierParts.initializeOne(s1, s2);      
 | 
			
		||||
        
 | 
			
		||||
        Part p1 = new Part("p1");
 | 
			
		||||
        Part p2 = new Part("p2");
 | 
			
		||||
        Part p3 = new Part("p3");
 | 
			
		||||
        Part p4 = new Part("p4");
 | 
			
		||||
        supplierParts.initializeMany(s1, p1,p2);
 | 
			
		||||
        supplierParts.initializeMany(s2, p3,p4);
 | 
			
		||||
        
 | 
			
		||||
        System.out.println(  supplierParts.getMany(s1));
 | 
			
		||||
        System.out.println(  supplierParts.getMany(s2));
 | 
			
		||||
        System.out.println( supplierParts.getOne(p1) );
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
    class Supplier
 | 
			
		||||
    {
 | 
			
		||||
        private String name;
 | 
			
		||||
 | 
			
		||||
        public Supplier(String name)
 | 
			
		||||
        {
 | 
			
		||||
            this.name = name;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public String getName()
 | 
			
		||||
        {
 | 
			
		||||
            return name;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void setName(String name)
 | 
			
		||||
        {
 | 
			
		||||
            this.name = name;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public String toString()
 | 
			
		||||
        {
 | 
			
		||||
            return "Supplier{" + "name=" + name + '}';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    class Part
 | 
			
		||||
    {
 | 
			
		||||
        private String name;
 | 
			
		||||
 | 
			
		||||
        public Part(String name)
 | 
			
		||||
        {
 | 
			
		||||
            this.name = name;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public String getName()
 | 
			
		||||
        {
 | 
			
		||||
            return name;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void setName(String name)
 | 
			
		||||
        {
 | 
			
		||||
            this.name = name;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public String toString()
 | 
			
		||||
        {
 | 
			
		||||
            return "Part{" + "name=" + name + '}';
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,39 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 model.factoryOneToMany;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * @author asdv5
 | 
			
		||||
 */
 | 
			
		||||
public class TestMap
 | 
			
		||||
{
 | 
			
		||||
    public static void main(String[] args)
 | 
			
		||||
    {
 | 
			
		||||
        HashMap<String, ArrayList<String>> map = new HashMap();
 | 
			
		||||
        ArrayList l1 = new ArrayList<String>();
 | 
			
		||||
        l1.add("p1");
 | 
			
		||||
        l1.add("p2");
 | 
			
		||||
        map.put("e1", l1);
 | 
			
		||||
        ArrayList l2 = new ArrayList<String>();
 | 
			
		||||
        l2.add("p2");
 | 
			
		||||
        l2.add("p3");
 | 
			
		||||
        map.put("e2", l2);
 | 
			
		||||
        System.out.println(map);
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
        Collection<ArrayList<String>> c  = map.values();
 | 
			
		||||
        System.out.println(c);
 | 
			
		||||
        for (ArrayList<String> a : c )
 | 
			
		||||
           a.remove("p2");
 | 
			
		||||
        System.out.println(c);
 | 
			
		||||
        System.out.println(map);
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -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>
 | 
			
		||||
							
								
								
									
										24
									
								
								Semester 3/Assignments/Ajz5/src/main/webapp/WEB-INF/web.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,24 @@
 | 
			
		||||
<?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/index.xhtml</welcome-file>
 | 
			
		||||
    </welcome-file-list>
 | 
			
		||||
</web-app>
 | 
			
		||||
							
								
								
									
										15
									
								
								Semester 3/Assignments/Ajz5/src/main/webapp/index.xhtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,15 @@
 | 
			
		||||
<?xml version='1.0' encoding='UTF-8' ?>
 | 
			
		||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 | 
			
		||||
<html xmlns="http://www.w3.org/1999/xhtml"
 | 
			
		||||
      xmlns:h="http://xmlns.jcp.org/jsf/html">
 | 
			
		||||
    <h:head>
 | 
			
		||||
        <title>Ajax 5</title>
 | 
			
		||||
    </h:head>
 | 
			
		||||
    <h:body>
 | 
			
		||||
        <h:form>
 | 
			
		||||
            <h:commandLink value="Prime Faces Ajax" action="prime-faces-ajax"/>
 | 
			
		||||
            <br/><br/>
 | 
			
		||||
            <h:commandLink value="JSF Ajax" action="jsf-ajax"/>
 | 
			
		||||
        </h:form>
 | 
			
		||||
    </h:body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										122
									
								
								Semester 3/Assignments/Ajz5/src/main/webapp/jsf-ajax.xhtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,122 @@
 | 
			
		||||
<?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"
 | 
			
		||||
      xmlns:f5="http://xmlns.jcp.org/jsf/passthrough"
 | 
			
		||||
      >
 | 
			
		||||
    <h:head>
 | 
			
		||||
        <title>JSF Ajax</title>
 | 
			
		||||
    </h:head>
 | 
			
		||||
    <h:body>
 | 
			
		||||
        <html lang="en"
 | 
			
		||||
              xmlns="http://www.w3.org/1999/xhtml"
 | 
			
		||||
              xmlns:f="http://xmlns.jcp.org/jsf/core"
 | 
			
		||||
              xmlns:h="http://xmlns.jcp.org/jsf/html"
 | 
			
		||||
              xmlns:jsf="http://xmlns.jcp.org/jsf"
 | 
			
		||||
              >
 | 
			
		||||
 | 
			
		||||
            <h:head>
 | 
			
		||||
                <h:outputStylesheet library="css" name="stylesheet.css" />
 | 
			
		||||
                <h:outputScript library="js" name="do_validation.js"/> 
 | 
			
		||||
 | 
			
		||||
            </h:head>
 | 
			
		||||
            <h:body>
 | 
			
		||||
 | 
			
		||||
    <h:form id="f1">
 | 
			
		||||
                    <h1>Ajax Prime Faces</h1>
 | 
			
		||||
                    <h2>Partial Proccess & Partial Update</h2>
 | 
			
		||||
                    <p:panelGrid columns="1" layout="grid"  >
 | 
			
		||||
                        <p:column>
 | 
			
		||||
 | 
			
		||||
                            <p:inputText id="full_name"
 | 
			
		||||
                                         value="#{partialProcessingBean.name}" 
 | 
			
		||||
                                         required="required" title="Enter your name."
 | 
			
		||||
                                         f5:placeholder="Name first & last"
 | 
			
		||||
                                         >
 | 
			
		||||
                            </p:inputText>
 | 
			
		||||
                        </p:column>
 | 
			
		||||
 | 
			
		||||
                        <p:column>
 | 
			
		||||
 | 
			
		||||
                            <p:outputLabel value="Country: " />
 | 
			
		||||
                            <p:selectOneMenu 
 | 
			
		||||
                                id="countries" value="#{partialProcessingBean.country}">
 | 
			
		||||
                                <f:selectItems value="#{partialProcessingBean.oneToMany.getAllOnes()}" />
 | 
			
		||||
 | 
			
		||||
                                <p:ajax listener= "#{partialProcessingBean.handleCountryChange}"
 | 
			
		||||
                                        event="change" update="cities" process="@this"/>
 | 
			
		||||
                            </p:selectOneMenu>
 | 
			
		||||
 | 
			
		||||
                            <p:outputLabel value="City: " />
 | 
			
		||||
                            <p:selectOneMenu id="cities" value="#{partialProcessingBean.city}">
 | 
			
		||||
                                <f:selectItems value="#{partialProcessingBean.getMany()}" />
 | 
			
		||||
                            </p:selectOneMenu>
 | 
			
		||||
 | 
			
		||||
                        </p:column>
 | 
			
		||||
                        <p:column>
 | 
			
		||||
 | 
			
		||||
                            <p:inputText  id="email1"
 | 
			
		||||
                                          f5:placeholder="Enter your email"
 | 
			
		||||
                                          value="#{partialProcessingBean.email}" 
 | 
			
		||||
                                          required="required"
 | 
			
		||||
                                          title="Enter email"/>
 | 
			
		||||
 | 
			
		||||
                            <p:inputText  id="email2"
 | 
			
		||||
                                          f5:placeholder="Enter email again"
 | 
			
		||||
                                          value="#{partialProcessingBean.emailAgain}" 
 | 
			
		||||
                                          required="required"
 | 
			
		||||
                                          title="Enter email again."
 | 
			
		||||
                                          onblur="check('f1:email1', 'f1:email2')" />
 | 
			
		||||
 | 
			
		||||
                        </p:column>
 | 
			
		||||
                        <p:column>
 | 
			
		||||
 | 
			
		||||
                            <p:calendar  id="date" 
 | 
			
		||||
                                         f5:placeholder="Performance date"
 | 
			
		||||
                                         readonlyInput="true"
 | 
			
		||||
                                         value="#{partialProcessingBean.date}" 
 | 
			
		||||
                                         required="required"
 | 
			
		||||
                                         title="Enter or choose a date."/>
 | 
			
		||||
                        </p:column>
 | 
			
		||||
                        <p:column style="padding: 30px;">
 | 
			
		||||
 | 
			
		||||
                            <p:outputLabel value="Number of Tickets: " />
 | 
			
		||||
 | 
			
		||||
                            <p:inputText id="tickets" value="#{partialProcessingBean.tickets}">
 | 
			
		||||
                                <f:passThroughAttributes value="#{partialProcessingBean.ticketAttrs}"/>
 | 
			
		||||
                                <p:ajax event="change" update="total" 
 | 
			
		||||
                                        listener="#{partialProcessingBean.calculateTotal}"/>
 | 
			
		||||
                            </p:inputText>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                            <p:outputLabel value="Ticket price: " />
 | 
			
		||||
 | 
			
		||||
                            <p:inputText id="price" 
 | 
			
		||||
                                         value="#{partialProcessingBean.price}" 
 | 
			
		||||
 | 
			
		||||
                                          p:required="required" >
 | 
			
		||||
                                <f:passThroughAttributes value="#{partialProcessingBean.priceAttrs}"/>
 | 
			
		||||
 | 
			
		||||
                                <p:ajax event="change" update="total" process="@this"
 | 
			
		||||
                                        listener="#{partialProcessingBean.calculateTotal}"/>
 | 
			
		||||
                            </p:inputText>
 | 
			
		||||
                            <br/>
 | 
			
		||||
                            <p:outputLabel value="Estimated total: " />
 | 
			
		||||
 | 
			
		||||
                            <p:outputLabel id="total"
 | 
			
		||||
                                           value="#{partialProcessingBean.totalValue}"
 | 
			
		||||
                                           >
 | 
			
		||||
                            </p:outputLabel>
 | 
			
		||||
                        </p:column>
 | 
			
		||||
 | 
			
		||||
                    </p:panelGrid>
 | 
			
		||||
                    <p:commandButton value="Clear and update all" 
 | 
			
		||||
                                     action="confirmation">
 | 
			
		||||
                        <p:ajax update="@all" listener="#{partialProcessingBean.clear}"/>
 | 
			
		||||
                    </p:commandButton>
 | 
			
		||||
                </h:form>
 | 
			
		||||
            </h:body>
 | 
			
		||||
        </html>
 | 
			
		||||
    </h:body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,122 @@
 | 
			
		||||
<?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"
 | 
			
		||||
      xmlns:f5="http://xmlns.jcp.org/jsf/passthrough"
 | 
			
		||||
      >
 | 
			
		||||
    <h:head>
 | 
			
		||||
        <title>Prime Paces Ajax</title>
 | 
			
		||||
    </h:head>
 | 
			
		||||
    <h:body>
 | 
			
		||||
        <html lang="en"
 | 
			
		||||
              xmlns="http://www.w3.org/1999/xhtml"
 | 
			
		||||
              xmlns:f="http://xmlns.jcp.org/jsf/core"
 | 
			
		||||
              xmlns:h="http://xmlns.jcp.org/jsf/html"
 | 
			
		||||
              xmlns:jsf="http://xmlns.jcp.org/jsf"
 | 
			
		||||
              >
 | 
			
		||||
 | 
			
		||||
            <h:head>
 | 
			
		||||
                <h:outputStylesheet library="css" name="stylesheet.css" />
 | 
			
		||||
                <h:outputScript library="js" name="do_validation.js"/> 
 | 
			
		||||
 | 
			
		||||
            </h:head>
 | 
			
		||||
            <h:body>
 | 
			
		||||
 | 
			
		||||
                <h:form id="f1">
 | 
			
		||||
                    <h1>Ajax Prime Faces</h1>
 | 
			
		||||
                    <h2>Partial Proccess & Partial Update</h2>
 | 
			
		||||
                    <p:panelGrid columns="1" layout="grid"  >
 | 
			
		||||
                        <p:column>
 | 
			
		||||
 | 
			
		||||
                            <p:inputText id="full_name"
 | 
			
		||||
                                         value="#{partialProcessingBean.name}" 
 | 
			
		||||
                                         required="required" title="Enter your name."
 | 
			
		||||
                                         f5:placeholder="Name first & last"
 | 
			
		||||
                                         >
 | 
			
		||||
                            </p:inputText>
 | 
			
		||||
                        </p:column>
 | 
			
		||||
 | 
			
		||||
                        <p:column>
 | 
			
		||||
 | 
			
		||||
                            <p:outputLabel value="Country: " />
 | 
			
		||||
                            <p:selectOneMenu 
 | 
			
		||||
                                id="countries" value="#{partialProcessingBean.country}">
 | 
			
		||||
                                <f:selectItems value="#{partialProcessingBean.oneToMany.getAllOnes()}" />
 | 
			
		||||
 | 
			
		||||
                                <p:ajax listener= "#{partialProcessingBean.handleCountryChange}"
 | 
			
		||||
                                        event="change" update="cities" process="@this"/>
 | 
			
		||||
                            </p:selectOneMenu>
 | 
			
		||||
 | 
			
		||||
                            <p:outputLabel value="City: " />
 | 
			
		||||
                            <p:selectOneMenu id="cities" value="#{partialProcessingBean.city}">
 | 
			
		||||
                                <f:selectItems value="#{partialProcessingBean.getMany()}" />
 | 
			
		||||
                            </p:selectOneMenu>
 | 
			
		||||
 | 
			
		||||
                        </p:column>
 | 
			
		||||
                        <p:column>
 | 
			
		||||
 | 
			
		||||
                            <p:inputText  id="email1"
 | 
			
		||||
                                          f5:placeholder="Enter your email"
 | 
			
		||||
                                          value="#{partialProcessingBean.email}" 
 | 
			
		||||
                                          required="required"
 | 
			
		||||
                                          title="Enter email"/>
 | 
			
		||||
 | 
			
		||||
                            <p:inputText  id="email2"
 | 
			
		||||
                                          f5:placeholder="Enter email again"
 | 
			
		||||
                                          value="#{partialProcessingBean.emailAgain}" 
 | 
			
		||||
                                          required="required"
 | 
			
		||||
                                          title="Enter email again."
 | 
			
		||||
                                          onblur="check('f1:email1', 'f1:email2')" />
 | 
			
		||||
 | 
			
		||||
                        </p:column>
 | 
			
		||||
                        <p:column>
 | 
			
		||||
 | 
			
		||||
                            <p:calendar  id="date" 
 | 
			
		||||
                                         f5:placeholder="Performance date"
 | 
			
		||||
                                         readonlyInput="true"
 | 
			
		||||
                                         value="#{partialProcessingBean.date}" 
 | 
			
		||||
                                         required="required"
 | 
			
		||||
                                         title="Enter or choose a date."/>
 | 
			
		||||
                        </p:column>
 | 
			
		||||
                        <p:column style="padding: 30px;">
 | 
			
		||||
 | 
			
		||||
                            <p:outputLabel value="Number of Tickets: " />
 | 
			
		||||
 | 
			
		||||
                            <p:inputText id="tickets" value="#{partialProcessingBean.tickets}">
 | 
			
		||||
                                <f:passThroughAttributes value="#{partialProcessingBean.ticketAttrs}"/>
 | 
			
		||||
                                <p:ajax event="change" update="total" 
 | 
			
		||||
                                        listener="#{partialProcessingBean.calculateTotal}"/>
 | 
			
		||||
                            </p:inputText>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                            <p:outputLabel value="Ticket price: " />
 | 
			
		||||
 | 
			
		||||
                            <p:inputText id="price" 
 | 
			
		||||
                                         value="#{partialProcessingBean.price}" 
 | 
			
		||||
 | 
			
		||||
                                          p:required="required" >
 | 
			
		||||
                                <f:passThroughAttributes value="#{partialProcessingBean.priceAttrs}"/>
 | 
			
		||||
 | 
			
		||||
                                <p:ajax event="change" update="total" process="@this"
 | 
			
		||||
                                        listener="#{partialProcessingBean.calculateTotal}"/>
 | 
			
		||||
                            </p:inputText>
 | 
			
		||||
                            <br/>
 | 
			
		||||
                            <p:outputLabel value="Estimated total: " />
 | 
			
		||||
 | 
			
		||||
                            <p:outputLabel id="total"
 | 
			
		||||
                                           value="#{partialProcessingBean.totalValue}"
 | 
			
		||||
                                           >
 | 
			
		||||
                            </p:outputLabel>
 | 
			
		||||
                        </p:column>
 | 
			
		||||
 | 
			
		||||
                    </p:panelGrid>
 | 
			
		||||
                    <p:commandButton value="Clear and update all" 
 | 
			
		||||
                                     action="confirmation">
 | 
			
		||||
                        <p:ajax update="@all" listener="#{partialProcessingBean.clear}"/>
 | 
			
		||||
                    </p:commandButton>
 | 
			
		||||
                </h:form>
 | 
			
		||||
            </h:body>
 | 
			
		||||
        </html>
 | 
			
		||||
    </h:body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,37 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * You may not modify, use, reproduce, or distribute this software except in
 | 
			
		||||
 * compliance with  the terms of the License at:
 | 
			
		||||
 * http://java.net/projects/javaeetutorial/pages/BerkeleyLicense
 | 
			
		||||
 */
 | 
			
		||||
input {
 | 
			
		||||
   -moz-border-radius:6px;
 | 
			
		||||
   -webkit-border-radius:6px;
 | 
			
		||||
   border-radius:6px;
 | 
			
		||||
   font-size:14px;
 | 
			
		||||
   width:300px;
 | 
			
		||||
   min-height:24px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
output {
 | 
			
		||||
   font-size:14px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
body {
 | 
			
		||||
    background-color: #ffffff;
 | 
			
		||||
    font-size: 14px;
 | 
			
		||||
    font-family: Verdana, "Verdana CE",  Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif;
 | 
			
		||||
    color: #000000;  
 | 
			
		||||
    margin: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
h2 {
 | 
			
		||||
    font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif;
 | 
			
		||||
    border-bottom: 1px solid #AFAFAF; 
 | 
			
		||||
    font-size:  18px;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
    margin: 0px;
 | 
			
		||||
    padding: 0px;
 | 
			
		||||
    color: #D20005;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
 | 
			
		||||
function check(email1, email2) {
 | 
			
		||||
    var e1 = document.getElementById(email1).value;
 | 
			
		||||
    var e2 = document.getElementById(email2).value;
 | 
			
		||||
 | 
			
		||||
    if (e1 != e2)
 | 
			
		||||
        alert("Emails don't match.");
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										14
									
								
								Semester 3/Assignments/MaxTask/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,14 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
    <groupId>edu.slcc.asdv.caleb</groupId>
 | 
			
		||||
    <artifactId>MaxTask</artifactId>
 | 
			
		||||
    <version>1.0-SNAPSHOT</version>
 | 
			
		||||
    <packaging>jar</packaging>
 | 
			
		||||
    <properties>
 | 
			
		||||
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
			
		||||
        <maven.compiler.source>20</maven.compiler.source>
 | 
			
		||||
        <maven.compiler.target>20</maven.compiler.target>
 | 
			
		||||
        <exec.mainClass>edu.slcc.asdv.caleb.maxtask.MaxTask</exec.mainClass>
 | 
			
		||||
    </properties>
 | 
			
		||||
</project>
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package edu.slcc.asdv.caleb.maxtask;
 | 
			
		||||
 | 
			
		||||
import java.util.concurrent.RecursiveTask;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * @author caleb
 | 
			
		||||
 */
 | 
			
		||||
public class MaxTask {
 | 
			
		||||
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
       
 | 
			
		||||
    }
 | 
			
		||||
    public static int max(int[] list) {
 | 
			
		||||
        RecursiveTask<Integer> task = new MaxTask(list 0, list.length) {
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Semester 3/Assignments/Templates01_CalebFontenot/01templates.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								Semester 3/Assignments/Templates01_CalebFontenot/02templates.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -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 3/Assignments/Templates01_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>Templates01_CalebFontenot</artifactId>
 | 
			
		||||
    <version>1.0-SNAPSHOT</version>
 | 
			
		||||
    <packaging>war</packaging>
 | 
			
		||||
    <name>Templates01_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,26 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 jakarta.inject.Named;
 | 
			
		||||
import jakarta.enterprise.context.Dependent;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * @author caleb
 | 
			
		||||
 */
 | 
			
		||||
@Named(value="randomNumberGenerator")
 | 
			
		||||
@Dependent
 | 
			
		||||
public class RandomNumberGenerator {
 | 
			
		||||
 | 
			
		||||
    /** Creates a new instance of RandomNumberGenerator */
 | 
			
		||||
    public RandomNumberGenerator() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getRandomNum() {
 | 
			
		||||
        return Math.random();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
package edu.slcc.asdv.caleb.templates01_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.templates01_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="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/index.xhtml</welcome-file>
 | 
			
		||||
    </welcome-file-list>
 | 
			
		||||
</web-app>
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
<?xml version='1.0' encoding='UTF-8' ?>
 | 
			
		||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 | 
			
		||||
<html xmlns="http://www.w3.org/1999/xhtml"
 | 
			
		||||
      xmlns:h="jakarta.faces.html">
 | 
			
		||||
    <h:head>
 | 
			
		||||
        <title>Templates Test</title>
 | 
			
		||||
    </h:head>
 | 
			
		||||
    <h:body>
 | 
			
		||||
        <h:form>
 | 
			
		||||
            <h:commandLink value="JSF Page using sample-template" action="sample-page"/>
 | 
			
		||||
        </h:form>
 | 
			
		||||
    </h:body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,28 @@
 | 
			
		||||
<?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"
 | 
			
		||||
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
 | 
			
		||||
    <h:head>
 | 
			
		||||
        <title>Multiple Snippets</title>
 | 
			
		||||
        <h:outputStylesheet library="css" name="styles.css"/>
 | 
			
		||||
    </h:head>
 | 
			
		||||
    <h:body>
 | 
			
		||||
        <h1 class="title1">Some Random Page</h1>
 | 
			
		||||
        <h2>This page reuses the included file in multiple places</h2>
 | 
			
		||||
        <ui:include src="/resources/snippets/piece-of-JSF-html.xhtml"/>
 | 
			
		||||
        <hr/>
 | 
			
		||||
        
 | 
			
		||||
        <ui:include src="/resources/snippets/piece-of-JSF-html.xhtml"/>
 | 
			
		||||
        <hr/>
 | 
			
		||||
        
 | 
			
		||||
        <div style="float: right">
 | 
			
		||||
            <ui:include src="/resources/snippets/piece-of-JSF-html.xhtml"/>
 | 
			
		||||
        </div>
 | 
			
		||||
        <p align="center">Blah, blah, blah.
 | 
			
		||||
            Blah, blah, blah. <br/>
 | 
			
		||||
            More blah, blah, blah.
 | 
			
		||||
            Blah, blah, blah.
 | 
			
		||||
        </p>
 | 
			
		||||
    </h:body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,35 @@
 | 
			
		||||
/*
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/CascadeStyleSheet.css to edit this template
 | 
			
		||||
*/
 | 
			
		||||
/* 
 | 
			
		||||
    Created on : Feb 15, 2024, 12:38:08 PM
 | 
			
		||||
    Author     : caleb
 | 
			
		||||
*/
 | 
			
		||||
body {
 | 
			
		||||
    font-family: Comic Sans MS, Ariel, Helvetica, sans-serif;
 | 
			
		||||
    background-color: #e9e9e9;
 | 
			
		||||
}
 | 
			
		||||
a:hover { color: red }
 | 
			
		||||
h1,h2,h3 {
 | 
			
		||||
    text-align: center;
 | 
			
		||||
    font-family: Comic Sans MS, Ariel, Helvetica, sans-serif;
 | 
			
		||||
    color: black;
 | 
			
		||||
}
 | 
			
		||||
title1 {
 | 
			
		||||
    display: table;
 | 
			
		||||
    margin:auto;
 | 
			
		||||
    background-color: yellow;
 | 
			
		||||
    font-family: Comic Sans MS, Ariel, Helvetica, sans-serif;
 | 
			
		||||
    font-size: xx-large;
 | 
			
		||||
    padding: 5px 8px;
 | 
			
		||||
    letter-spacing: -.025em;
 | 
			
		||||
}
 | 
			
		||||
.white {
 | 
			
		||||
    color: white;
 | 
			
		||||
    font-family: Comic Sans MS, Ariel, Helvetica, sans-serif;
 | 
			
		||||
    font-size: 80%;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
    text-decoration: none;
 | 
			
		||||
}
 | 
			
		||||
.dark { background-color: black; }
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
 | 
			
		||||
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
 | 
			
		||||
    <div style="background-color: yellow">
 | 
			
		||||
            <h3>This is a piece of JSF and HTML content<br/>
 | 
			
		||||
            A random number: #{randomNumberGenerator.randomNum}
 | 
			
		||||
        </h3>
 | 
			
		||||
    </div>
 | 
			
		||||
</ui:composition>
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
 | 
			
		||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
 | 
			
		||||
    
 | 
			
		||||
    <form action="https://search.calebfontenot.com">
 | 
			
		||||
        <input type="text" name="q"/><br/>
 | 
			
		||||
        <input type="submit" value="SearXNG"/>
 | 
			
		||||
    </form>
 | 
			
		||||
</ui:composition>
 | 
			
		||||
@@ -0,0 +1,22 @@
 | 
			
		||||
<?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"
 | 
			
		||||
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
 | 
			
		||||
    <h:head>
 | 
			
		||||
        <title>
 | 
			
		||||
            <ui:insert name="title">This will be replaced and appear in the browser's toolbar</ui:insert>
 | 
			
		||||
        </title>
 | 
			
		||||
        
 | 
			
		||||
        <h:outputStylesheet library="css" name="styles.css"/>
 | 
			
		||||
    </h:head>
 | 
			
		||||
    <h:body>
 | 
			
		||||
        <title1>
 | 
			
		||||
            <ui:insert name="title1">This page is supposed to be replaced</ui:insert>
 | 
			
		||||
        </title1>
 | 
			
		||||
        <h2>This will appear in every page that uses this template<br/>
 | 
			
		||||
            --Random number Generator: #{randomNumberGenerator.randomNum}</h2>
 | 
			
		||||
            
 | 
			
		||||
            <ui:insert name="content">To be replaced by ui:define using content</ui:insert>
 | 
			
		||||
    </h:body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,21 @@
 | 
			
		||||
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
 | 
			
		||||
                            xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
 | 
			
		||||
                            xmlns:h="jakarta.faces.html"
 | 
			
		||||
                            template="/resources/templates/sample-template.xhtml">
 | 
			
		||||
 | 
			
		||||
    <ui:define name="title">
 | 
			
		||||
        Sample-Template
 | 
			
		||||
    </ui:define>
 | 
			
		||||
    
 | 
			
		||||
    <ui:define name="title1">
 | 
			
		||||
        Title of page
 | 
			
		||||
    </ui:define>
 | 
			
		||||
    
 | 
			
		||||
    <ui:define name="content">
 | 
			
		||||
        <h:button value="button"></h:button>
 | 
			
		||||
               <p>This is the replacing content.</p>
 | 
			
		||||
               <p>Blah, blah, blah.</p>
 | 
			
		||||
               <p>More Blah, blah, blah.</p>
 | 
			
		||||
               <p>Even more Blah, blah, blah.</p>
 | 
			
		||||
    </ui:define>
 | 
			
		||||
</ui:composition>
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Semester 3/Assignments/Templates01_CalebFontenot/templates03.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								Semester 3/Assignments/Templates01_CalebFontenot/templates04.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										20
									
								
								Semester 3/Assignments/mavenproject1/nb-configuration.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -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>
 | 
			
		||||
							
								
								
									
										48
									
								
								Semester 3/Assignments/mavenproject1/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,48 @@
 | 
			
		||||
<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>mavenproject1</artifactId>
 | 
			
		||||
    <version>1.0-SNAPSHOT</version>
 | 
			
		||||
    <packaging>war</packaging>
 | 
			
		||||
    <name>mavenproject1-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>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.primefaces</groupId>
 | 
			
		||||
            <artifactId>primefaces</artifactId>
 | 
			
		||||
            <version>13.0.5</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,45 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 car;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * @author caleb
 | 
			
		||||
 */
 | 
			
		||||
class Car implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private String name;
 | 
			
		||||
    private int year;
 | 
			
		||||
 | 
			
		||||
    public Car(String name, int year)
 | 
			
		||||
    {
 | 
			
		||||
        this.name = name;
 | 
			
		||||
        this.year = year;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getYear()
 | 
			
		||||
    {
 | 
			
		||||
        return year;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setYear(int year)
 | 
			
		||||
    {
 | 
			
		||||
        this.year = year;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public String getName()
 | 
			
		||||
    {
 | 
			
		||||
        return name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setName(String name)
 | 
			
		||||
    {
 | 
			
		||||
        this.name = name;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,141 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 car;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * @author caleb
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import jakarta.faces.application.FacesMessage;
 | 
			
		||||
import jakarta.faces.context.FacesContext;
 | 
			
		||||
import jakarta.faces.view.ViewScoped;
 | 
			
		||||
import jakarta.inject.Named;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import org.primefaces.event.SelectEvent;
 | 
			
		||||
 | 
			
		||||
@Named(value = "carAutoCompleteBean")
 | 
			
		||||
@ViewScoped
 | 
			
		||||
public class CarAutoCompleteBean implements Serializable
 | 
			
		||||
{
 | 
			
		||||
    private Car selectedCar;
 | 
			
		||||
    private static Map<String, Car> cars = new HashMap<String, Car>();
 | 
			
		||||
 | 
			
		||||
    String simpleText;
 | 
			
		||||
    List<String> multipleSelects;
 | 
			
		||||
    
 | 
			
		||||
    public CarAutoCompleteBean()
 | 
			
		||||
    {
 | 
			
		||||
        cars.put("BMW", new Car("BMW", 2024));
 | 
			
		||||
        cars.put("CC", new Car("CC", 2018));
 | 
			
		||||
        cars.put("Golf", new Car("Golf", 1998));
 | 
			
		||||
        cars.put("Jetta", new Car("Jetta", 2012));
 | 
			
		||||
        cars.put("Passat", new Car("Passat", 2016));
 | 
			
		||||
 | 
			
		||||
        cars.put("Polo", new Car("Polo", 1978));
 | 
			
		||||
       cars.put("Scirocco", new Car("Scirocco", 1981));
 | 
			
		||||
       cars.put("Touareg", new Car("Touareg", 2019));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<String> getMultipleSelects()
 | 
			
		||||
    {
 | 
			
		||||
        return multipleSelects;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setMultipleSelects(List<String> multipleSelects)
 | 
			
		||||
    {
 | 
			
		||||
        this.multipleSelects = multipleSelects;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static Map<String, Car> getCars()
 | 
			
		||||
    {
 | 
			
		||||
        return cars;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Car getSelectedCar()
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println(selectedCar);
 | 
			
		||||
        return selectedCar;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSelectedCar(Car selectedCar)
 | 
			
		||||
    {
 | 
			
		||||
        this.selectedCar = selectedCar;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<Car> completeCar(String input)
 | 
			
		||||
    {
 | 
			
		||||
        List<Car> suggestions = new ArrayList<Car>();
 | 
			
		||||
        Set<String> keys = cars.keySet();
 | 
			
		||||
        for (String key : keys)
 | 
			
		||||
        {
 | 
			
		||||
            if (key.startsWith(input))
 | 
			
		||||
            {
 | 
			
		||||
                suggestions.add(cars.get(key));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return suggestions;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<Car> completeCarContains(String input)
 | 
			
		||||
    {
 | 
			
		||||
        List<Car> suggestions = new ArrayList<Car>();
 | 
			
		||||
        Set<String> keys = cars.keySet();
 | 
			
		||||
        for (String key : keys)
 | 
			
		||||
        {
 | 
			
		||||
            String s = key.toLowerCase();
 | 
			
		||||
            if (s.contains(input.toLowerCase()))
 | 
			
		||||
            {
 | 
			
		||||
                suggestions.add(cars.get(key));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return suggestions;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getSimpleText()
 | 
			
		||||
    {
 | 
			
		||||
        return simpleText;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSimpleText(String simpleText)
 | 
			
		||||
    {
 | 
			
		||||
        this.simpleText = simpleText;
 | 
			
		||||
    }
 | 
			
		||||
    public List<String> completeSimple(String input)
 | 
			
		||||
    {
 | 
			
		||||
        List<String> suggestions = new ArrayList<String>();
 | 
			
		||||
        
 | 
			
		||||
        for (char c ='A'; c < 'Z'; ++c)
 | 
			
		||||
        {
 | 
			
		||||
           suggestions.add( Character.toString(c));
 | 
			
		||||
        }
 | 
			
		||||
        return suggestions;
 | 
			
		||||
    }
 | 
			
		||||
    public void handleSelect(SelectEvent event)
 | 
			
		||||
    {
 | 
			
		||||
       System.out.println("handleSelect:" + event );
 | 
			
		||||
        Object selectedObject = event.getObject();
 | 
			
		||||
        FacesMessage msg = new FacesMessage("Selected", "Item:" + selectedObject);
 | 
			
		||||
        FacesContext.getCurrentInstance().addMessage(null, msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void handleSelectSimple(SelectEvent event)
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println("handleSelect:" + event );
 | 
			
		||||
        Object selectedObject = event.getObject();
 | 
			
		||||
        FacesMessage msg = new FacesMessage("Selected", "Item:" + selectedObject);
 | 
			
		||||
        FacesContext.getCurrentInstance().addMessage(null, msg);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
   
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
package edu.slcc.asdv.caleb.mavenproject1;
 | 
			
		||||
 | 
			
		||||
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.mavenproject1.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="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/index.xhtml</welcome-file>
 | 
			
		||||
    </welcome-file-list>
 | 
			
		||||
</web-app>
 | 
			
		||||
@@ -0,0 +1,64 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
 | 
			
		||||
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 | 
			
		||||
<html xmlns="http://www.w3.org/1999/xhtml"
 | 
			
		||||
      xmlns:f="http://java.sun.com/jsf/core" 
 | 
			
		||||
      xmlns:h="http://java.sun.com/jsf/html"
 | 
			
		||||
      xmlns:p="http://primefaces.org/ui"
 | 
			
		||||
      xmlns:f5="http://xmlns.jcp.org/jsf/passthrough"
 | 
			
		||||
      >
 | 
			
		||||
 | 
			
		||||
    <h:head>
 | 
			
		||||
        <title>#{msgs.title}</title>
 | 
			
		||||
    </h:head>
 | 
			
		||||
    <h:body>
 | 
			
		||||
        <h:form>
 | 
			
		||||
            <p:growl id="growl" showDetail="true" showSummary="true"  life="8000"
 | 
			
		||||
                     redisplay="false"
 | 
			
		||||
                     />
 | 
			
		||||
            <h:panelGrid columns="3" >
 | 
			
		||||
                <p:autoComplete id="carPOJO"
 | 
			
		||||
                                value="#{carAutoCompleteBean.selectedCar}"
 | 
			
		||||
                                completeMethod="#{carAutoCompleteBean.completeCarContains}"
 | 
			
		||||
                                itemLabel="#{car.name}" 
 | 
			
		||||
                                var="car" 
 | 
			
		||||
                                itemValue="#{car}"
 | 
			
		||||
                                forceSelection="true"
 | 
			
		||||
                                converter="#{carConverter}"
 | 
			
		||||
                                f5:placeholder="select a car"
 | 
			
		||||
                                size="50"
 | 
			
		||||
                                >
 | 
			
		||||
                    <p:ajax event="itemSelect"
 | 
			
		||||
                            listener="#{carAutoCompleteBean.handleSelect}"
 | 
			
		||||
                            update="growl" />                        
 | 
			
		||||
                    <p:column>
 | 
			
		||||
                        <h:graphicImage library="images" name="#{car.name}.png"/>
 | 
			
		||||
                    </p:column>
 | 
			
		||||
                    <p:column>#{car.name}</p:column>
 | 
			
		||||
 | 
			
		||||
                </p:autoComplete> 
 | 
			
		||||
 | 
			
		||||
                <p:autoComplete id="id_letter" value="#{carAutoCompleteBean.simpleText}"
 | 
			
		||||
                                
 | 
			
		||||
                                completeMethod="#{carAutoCompleteBean.completeSimple}"
 | 
			
		||||
                                forceSelection="true"
 | 
			
		||||
                                f5:placeholder="select a letter"
 | 
			
		||||
                                >
 | 
			
		||||
                  
 | 
			
		||||
                </p:autoComplete>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                <p:autoComplete id="id_multipleSelect"
 | 
			
		||||
                                value="#{multi.selectedTexts}"
 | 
			
		||||
                                completeMethod="#{multi.complete}"
 | 
			
		||||
                                f5:placeholder="select multiple"
 | 
			
		||||
                                multiple="true" >
 | 
			
		||||
                                <p:ajax event="itemSelect" 
 | 
			
		||||
                        listener="#{multi.handleSelect}" update="growl id_multipleSelect" />
 | 
			
		||||
                </p:autoComplete>
 | 
			
		||||
 | 
			
		||||
            </h:panelGrid>
 | 
			
		||||
        </h:form>
 | 
			
		||||
    </h:body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
    <head>
 | 
			
		||||
        <title>Start Page</title>
 | 
			
		||||
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
        <h1>Hello World!</h1>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
| 
		 After Width: | Height: | Size: 30 KiB  | 
| 
		 After Width: | Height: | Size: 68 KiB  | 
| 
		 After Width: | Height: | Size: 68 KiB  | 
| 
		 After Width: | Height: | Size: 64 KiB  | 
| 
		 After Width: | Height: | Size: 70 KiB  | 
| 
		 After Width: | Height: | Size: 65 KiB  | 
| 
		 After Width: | Height: | Size: 54 KiB  | 
| 
		 After Width: | Height: | Size: 68 KiB  |