Markou moment

This commit is contained in:
2024-02-16 17:19:54 -06:00
parent 80bfa39936
commit b96b2eeb8c
74 changed files with 5618 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>

View File

@@ -0,0 +1,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>

View File

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

View File

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

View File

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