Ajax Smajax
This commit is contained in:
BIN
Semester 3/Examples/ajax-examples.zip
Normal file
BIN
Semester 3/Examples/ajax-examples.zip
Normal file
Binary file not shown.
BIN
Semester 3/Examples/ajax-examples/.DS_Store
vendored
Normal file
BIN
Semester 3/Examples/ajax-examples/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
Semester 3/Examples/ajax-examples/Ajax1_Echo.zip
Normal file
BIN
Semester 3/Examples/ajax-examples/Ajax1_Echo.zip
Normal file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scene Scope="Project" version="2">
|
||||
<Scope Scope="Faces Configuration Only"/>
|
||||
<Scope Scope="Project"/>
|
||||
<Scope Scope="All Faces Configurations"/>
|
||||
</Scene>
|
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-shared-configuration>
|
||||
<!--
|
||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||
The configuration is intended to be shared among all the users of project and
|
||||
therefore it is assumed to be part of version control checkout.
|
||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||
-->
|
||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||
<!--
|
||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||
-->
|
||||
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||
<netbeans.hint.jdkPlatform>JDK_15__System_</netbeans.hint.jdkPlatform>
|
||||
</properties>
|
||||
</project-shared-configuration>
|
77
Semester 3/Examples/ajax-examples/Ajax1_Echo/pom.xml
Normal file
77
Semester 3/Examples/ajax-examples/Ajax1_Echo/pom.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>asdv</groupId>
|
||||
<artifactId>Ajax1</artifactId>
|
||||
<version>1</version>
|
||||
<packaging>war</packaging>
|
||||
<name>Ajax1-Echo</name>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<jakartaee>10.0.0</jakartaee>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>jakarta.platform</groupId>
|
||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||
<version>${jakartaee}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
<compilerArguments>
|
||||
<endorseddirs>${endorsed.dir}</endorseddirs>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${endorsed.dir}</outputDirectory>
|
||||
<silent>true</silent>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>jakarta.platform</groupId>
|
||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||
<version>${jakartaee}</version>
|
||||
<type>jar</type>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@@ -0,0 +1,13 @@
|
||||
package asdv.ajax1;
|
||||
|
||||
import jakarta.ws.rs.ApplicationPath;
|
||||
import jakarta.ws.rs.core.Application;
|
||||
|
||||
/**
|
||||
* Configures Jakarta RESTful Web Services for the application.
|
||||
* @author Juneau
|
||||
*/
|
||||
@ApplicationPath("resources")
|
||||
public class JakartaRestConfiguration extends Application {
|
||||
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package asdv.ajax1.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,36 @@
|
||||
package beans;
|
||||
|
||||
import java.io.Serializable;
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.enterprise.context.SessionScoped;
|
||||
|
||||
@Named("user")
|
||||
@SessionScoped
|
||||
public class UserBean implements Serializable
|
||||
{
|
||||
private String name = "";
|
||||
private String password;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String newValue)
|
||||
{
|
||||
System.out.println(newValue);
|
||||
name = newValue;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String newValue)
|
||||
{
|
||||
password = newValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -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 @@
|
||||
loginWindowTitle=Ajax Echo
|
||||
loginHeading=Please Log In
|
||||
namePrompt=Name:
|
||||
passwordPrompt=Password:
|
||||
loginButtonText=Log In
|
||||
greeting=Welcome
|
@@ -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,36 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!--
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
-->
|
||||
<faces-config version="4.0"
|
||||
xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd">
|
||||
|
||||
|
||||
|
||||
<application>
|
||||
<resource-bundle>
|
||||
<base-name>messages.messages</base-name>
|
||||
<var>msgs</var>
|
||||
</resource-bundle>
|
||||
</application>
|
||||
|
||||
</faces-config>
|
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program and the accompanying materials are made available under the
|
||||
terms of the Eclipse Public License v. 2.0, which is available at
|
||||
http://www.eclipse.org/legal/epl-2.0.
|
||||
|
||||
This Source Code may also be made available under the following Secondary
|
||||
Licenses when the conditions for such availability set forth in the
|
||||
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||
version 2 with the GNU Classpath Exception, which is available at
|
||||
https://www.gnu.org/software/classpath/license.html.
|
||||
|
||||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
-->
|
||||
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||
<glassfish-web-app error-url="">
|
||||
<class-loader delegate="true"/>
|
||||
<jsp-config>
|
||||
<property name="keepgenerated" value="true">
|
||||
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||
</property>
|
||||
</jsp-config>
|
||||
</glassfish-web-app>
|
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app version="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,32 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||
|
||||
|
||||
|
||||
<h:head>
|
||||
<title>#{msgs.loginWindowTitle}</title>
|
||||
</h:head>
|
||||
<h:body style="background: skyblue">
|
||||
<h:form>
|
||||
<h3>#{msgs.loginHeading}</h3>
|
||||
<h:panelGrid columns="2">
|
||||
#{msgs.namePrompt}
|
||||
|
||||
<h:inputText id="inputName" value="#{user.name}">
|
||||
<f:ajax event="keyup" execute="@this"
|
||||
render="echo"
|
||||
/>
|
||||
</h:inputText>
|
||||
|
||||
#{msgs.passwordPrompt}
|
||||
<h:inputSecret id = "inputPassword" value="#{user.password}" size="8"/>
|
||||
<h:commandButton value="#{msgs.loginButtonText}" action="welcome"/>
|
||||
</h:panelGrid>
|
||||
|
||||
<p><h:outputText id="echo" value="#{user.name}"/></p>
|
||||
</h:form>
|
||||
</h:body>
|
||||
</html>
|
@@ -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://java.sun.com/jsf/html">
|
||||
<h:head>
|
||||
<title>#{msgs.loginWindowTitle}</title>
|
||||
</h:head>
|
||||
|
||||
<h:body style="background: skyblue">
|
||||
<h3>#{msgs.greeting} #{user.name}!</h3>
|
||||
<br/>
|
||||
<h3>password: #{user.password}!</h3>
|
||||
</h:body>
|
||||
</html>
|
BIN
Semester 3/Examples/ajax-examples/Ajax2.zip
Normal file
BIN
Semester 3/Examples/ajax-examples/Ajax2.zip
Normal file
Binary file not shown.
19
Semester 3/Examples/ajax-examples/Ajax2/nb-configuration.xml
Normal file
19
Semester 3/Examples/ajax-examples/Ajax2/nb-configuration.xml
Normal file
@@ -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-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>
|
77
Semester 3/Examples/ajax-examples/Ajax2/pom.xml
Normal file
77
Semester 3/Examples/ajax-examples/Ajax2/pom.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>asdv</groupId>
|
||||
<artifactId>Ajax2</artifactId>
|
||||
<version>1</version>
|
||||
<packaging>war</packaging>
|
||||
<name>Ajax2-1</name>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<jakartaee>10.0.0</jakartaee>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>jakarta.platform</groupId>
|
||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||
<version>${jakartaee}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
<compilerArguments>
|
||||
<endorseddirs>${endorsed.dir}</endorseddirs>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${endorsed.dir}</outputDirectory>
|
||||
<silent>true</silent>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>jakarta.platform</groupId>
|
||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||
<version>${jakartaee}</version>
|
||||
<type>jar</type>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@@ -0,0 +1,13 @@
|
||||
package asdv.ajax2;
|
||||
|
||||
import jakarta.ws.rs.ApplicationPath;
|
||||
import jakarta.ws.rs.core.Application;
|
||||
|
||||
/**
|
||||
* Configures Jakarta RESTful Web Services for the application.
|
||||
* @author Juneau
|
||||
*/
|
||||
@ApplicationPath("resources")
|
||||
public class JakartaRestConfiguration extends Application {
|
||||
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package asdv.ajax2.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,400 @@
|
||||
|
||||
package edu.slcc.asdv;
|
||||
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.enterprise.context.SessionScoped;
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import jakarta.faces.application.FacesMessage;
|
||||
import jakarta.faces.context.FacesContext;
|
||||
import jakarta.faces.event.AbortProcessingException;
|
||||
import jakarta.faces.event.ActionEvent;
|
||||
import jakarta.faces.event.AjaxBehaviorEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ASDV2
|
||||
*/
|
||||
@Named(value = "AJAXBean")
|
||||
@SessionScoped
|
||||
public class AJAXBean implements Serializable
|
||||
{
|
||||
|
||||
private int counter = 0;
|
||||
|
||||
private String lastMessage = null;
|
||||
|
||||
private List<String> messages = new ArrayList<>();
|
||||
|
||||
private boolean bool;
|
||||
private boolean bool1;
|
||||
private boolean bool2;
|
||||
private boolean bool3;
|
||||
private boolean bool4;
|
||||
|
||||
private boolean spinning = true;
|
||||
private boolean readOnly = false;
|
||||
private boolean disabled = true;
|
||||
|
||||
private int age;
|
||||
|
||||
private String name;
|
||||
|
||||
private boolean buttonRed = false;
|
||||
|
||||
public void mouseOverListener(AjaxBehaviorEvent event)
|
||||
throws AbortProcessingException
|
||||
{
|
||||
report("f:ajax mouseOver listener called");
|
||||
setButtonRed(true);
|
||||
}
|
||||
|
||||
public void mouseOutListener(AjaxBehaviorEvent event)
|
||||
throws AbortProcessingException
|
||||
{
|
||||
report("f:ajax mouseOut listener called");
|
||||
setButtonRed(false);
|
||||
}
|
||||
|
||||
public void keyDownListener() throws AbortProcessingException
|
||||
{
|
||||
report("f:ajax keydown listener called");
|
||||
setButtonRed(false);
|
||||
}
|
||||
|
||||
public void keyDownListener(AjaxBehaviorEvent event) throws AbortProcessingException
|
||||
{
|
||||
report("f:ajax keydown listener called");
|
||||
setButtonRed(false);
|
||||
}
|
||||
|
||||
public boolean isSpinning()
|
||||
{
|
||||
return spinning;
|
||||
}
|
||||
|
||||
public void setSpinning(boolean spinning)
|
||||
{
|
||||
this.spinning = spinning;
|
||||
}
|
||||
|
||||
public boolean isReadOnly()
|
||||
{
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
public void setReadOnly(boolean readOnly)
|
||||
{
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
public boolean isDisabled()
|
||||
{
|
||||
return disabled;
|
||||
}
|
||||
|
||||
public void setDisabled(boolean disabled)
|
||||
{
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
public boolean isBool1()
|
||||
{
|
||||
return bool1;
|
||||
}
|
||||
|
||||
public void setBool1(boolean bool1)
|
||||
{
|
||||
this.bool1 = bool1;
|
||||
}
|
||||
|
||||
public boolean isBool2()
|
||||
{
|
||||
return bool2;
|
||||
}
|
||||
|
||||
public void setBool2(boolean bool2)
|
||||
{
|
||||
this.bool2 = bool2;
|
||||
}
|
||||
|
||||
public boolean isBool3()
|
||||
{
|
||||
return bool3;
|
||||
}
|
||||
|
||||
public void setBool3(boolean bool3)
|
||||
{
|
||||
this.bool3 = bool3;
|
||||
}
|
||||
|
||||
public boolean isBool4()
|
||||
{
|
||||
return bool4;
|
||||
}
|
||||
|
||||
public void setBool4(boolean bool4)
|
||||
{
|
||||
this.bool4 = bool4;
|
||||
}
|
||||
|
||||
private String input = "Ignore the text. It's not important.";
|
||||
|
||||
public AJAXBean()
|
||||
{
|
||||
// getMessages().add("No message yet.");
|
||||
// getMessages().add("Play with the combobox to add messages.");
|
||||
}
|
||||
|
||||
private int brand = 1;
|
||||
|
||||
public void clearMessages()
|
||||
{
|
||||
messages.clear();
|
||||
messages.add("Messages cleared by tab change AJAX event");
|
||||
}
|
||||
|
||||
public int getBrand()
|
||||
{
|
||||
return brand;
|
||||
}
|
||||
|
||||
private String now()
|
||||
{
|
||||
return new SimpleDateFormat("HH:mm:ss.SSS").format(new Date());
|
||||
}
|
||||
|
||||
public void setBrand(int brand)
|
||||
{
|
||||
this.brand = brand;
|
||||
messages.add(0, now() + " Setter has been called: " + brand);
|
||||
}
|
||||
|
||||
public List<String> getMessages()
|
||||
{
|
||||
return messages;
|
||||
}
|
||||
|
||||
public void setMessages(List<String> messages)
|
||||
{
|
||||
this.messages = messages;
|
||||
}
|
||||
|
||||
public String onBlur()
|
||||
{
|
||||
String event = " blur";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
private void report(String event)
|
||||
{
|
||||
if (event.equals(lastMessage))
|
||||
{
|
||||
counter++;
|
||||
messages.set(0, now() + " " + event + " (" + counter + ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
counter = 1;
|
||||
messages.add(0, now() + " " + event);
|
||||
}
|
||||
lastMessage = event;
|
||||
try
|
||||
{
|
||||
Thread.currentThread().sleep(1);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String onChange()
|
||||
{
|
||||
String event = " change";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onValueChange()
|
||||
{
|
||||
String event = " valueChange";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onClick()
|
||||
{
|
||||
String event = " click";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onDblClick()
|
||||
{
|
||||
String event = " dblclick";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onFocus()
|
||||
{
|
||||
String event = " focus";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onKeyDown()
|
||||
{
|
||||
String event = " keydown";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onKeyPress()
|
||||
{
|
||||
String event = " keypress";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onKeyUp()
|
||||
{
|
||||
String event = " keyup";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onMouseDown()
|
||||
{
|
||||
String event = " mousedown";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onMouseMove()
|
||||
{
|
||||
String event = " mousemove";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onMouseOut()
|
||||
{
|
||||
String event = " mouseout";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onMouseOver()
|
||||
{
|
||||
String event = " mouseover";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onMouseUp()
|
||||
{
|
||||
String event = " mouseup";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public String onSelect()
|
||||
{
|
||||
String event = " select";
|
||||
report(event);
|
||||
return "Hallo";
|
||||
}
|
||||
|
||||
public boolean isBool()
|
||||
{
|
||||
return bool;
|
||||
}
|
||||
|
||||
public void setBool(boolean bool)
|
||||
{
|
||||
this.bool = bool;
|
||||
}
|
||||
|
||||
public String getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
public void setInput(String input)
|
||||
{
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
public void standardJSFAction()
|
||||
{
|
||||
report("Standard JSF action called");
|
||||
// return null; // "landingPage.jsf";
|
||||
}
|
||||
|
||||
public void facetListener(AjaxBehaviorEvent event)
|
||||
throws AbortProcessingException
|
||||
{
|
||||
report("f:ajax listener called");
|
||||
}
|
||||
|
||||
public void facetListener2(AjaxBehaviorEvent event)
|
||||
throws AbortProcessingException
|
||||
{
|
||||
report("second f:ajax listener called");
|
||||
}
|
||||
|
||||
public void standardJSFActionListener()
|
||||
{
|
||||
report("Standard JSF actionlistener without parameters called");
|
||||
}
|
||||
|
||||
public void standardJSFActionListener(ActionEvent event)
|
||||
{
|
||||
report("Standard JSF actionlistener called");
|
||||
}
|
||||
|
||||
public void standardJSFActionListener2(ActionEvent event)
|
||||
{
|
||||
report("second standard JSF actionlistener called");
|
||||
}
|
||||
|
||||
public int getAge()
|
||||
{
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age)
|
||||
{
|
||||
this.age = age;
|
||||
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("You've successfully entered the age."));
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("You've successfully entered the name."));
|
||||
}
|
||||
|
||||
public boolean isButtonRed()
|
||||
{
|
||||
return buttonRed;
|
||||
}
|
||||
|
||||
public void setButtonRed(boolean buttonRed)
|
||||
{
|
||||
this.buttonRed = buttonRed;
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package edu.slcc.asdv;
|
||||
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.enterprise.context.RequestScoped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ASDV2
|
||||
*/
|
||||
@Named(value = "processingBean")
|
||||
@RequestScoped
|
||||
public class ProcessingBean
|
||||
{
|
||||
public void processing()
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
try
|
||||
{
|
||||
wait(3000);
|
||||
}
|
||||
catch (InterruptedException e1)
|
||||
{
|
||||
// waiting interrupted
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
package edu.slcc.asdv;
|
||||
|
||||
import jakarta.enterprise.context.RequestScoped;
|
||||
import jakarta.inject.Named;
|
||||
|
||||
|
||||
@Named(value = "testBean")
|
||||
@RequestScoped
|
||||
public class TestBean
|
||||
{
|
||||
private String farheneitTemperature;
|
||||
private String celciusTemperature;
|
||||
|
||||
private String miles;
|
||||
|
||||
public String getMiles()
|
||||
{
|
||||
return miles;
|
||||
}
|
||||
|
||||
public void setMiles(String miles)
|
||||
{
|
||||
System.out.println("miles: " + miles);
|
||||
this.miles = miles;
|
||||
}
|
||||
|
||||
public String milesToKilometers()
|
||||
{
|
||||
if ( this.miles == null )
|
||||
return null;
|
||||
double miles = Double.parseDouble( this.miles );
|
||||
double km = miles * 1.65;
|
||||
return String.valueOf(km);
|
||||
}
|
||||
|
||||
|
||||
public String getFarheneitTemperature(){return farheneitTemperature;}
|
||||
|
||||
public void setFarheneitTemperature(String farheneitTemperature)
|
||||
{
|
||||
this.farheneitTemperature = farheneitTemperature;
|
||||
System.out.println("setter: " + this.farheneitTemperature);
|
||||
this.celciusTemperature = convertFtoC();
|
||||
}
|
||||
public String getCelciusTemperature(){return celciusTemperature;}
|
||||
private String convertFtoC()
|
||||
{
|
||||
double f = Double.parseDouble( this.farheneitTemperature );
|
||||
double c = (f - 32) * ( 5.0 / 9.0);
|
||||
System.out.println("far: " + this.farheneitTemperature);
|
||||
System.out.println("convert " + c);
|
||||
celciusTemperature = String.valueOf(c);
|
||||
return celciusTemperature;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@@ -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 @@
|
||||
loginWindowTitle=Ajax Echo
|
||||
loginHeading=Please Log In
|
||||
namePrompt=Name:
|
||||
passwordPrompt=Password:
|
||||
loginButtonText=Log In
|
||||
greeting=Welcome
|
@@ -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,36 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!--
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
-->
|
||||
<faces-config version="4.0"
|
||||
xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd">
|
||||
|
||||
|
||||
|
||||
<application>
|
||||
<resource-bundle>
|
||||
<base-name>messages.messages</base-name>
|
||||
<var>msgs</var>
|
||||
</resource-bundle>
|
||||
</application>
|
||||
|
||||
</faces-config>
|
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program and the accompanying materials are made available under the
|
||||
terms of the Eclipse Public License v. 2.0, which is available at
|
||||
http://www.eclipse.org/legal/epl-2.0.
|
||||
|
||||
This Source Code may also be made available under the following Secondary
|
||||
Licenses when the conditions for such availability set forth in the
|
||||
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||
version 2 with the GNU Classpath Exception, which is available at
|
||||
https://www.gnu.org/software/classpath/license.html.
|
||||
|
||||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
-->
|
||||
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||
<glassfish-web-app error-url="">
|
||||
<class-loader delegate="true"/>
|
||||
<jsp-config>
|
||||
<property name="keepgenerated" value="true">
|
||||
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||
</property>
|
||||
</jsp-config>
|
||||
</glassfish-web-app>
|
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app version="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,29 @@
|
||||
<?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>#{msgs.loginWindowTitle}</title>
|
||||
<script src="./scripts/utils.js"
|
||||
type="text/javascript"></script>
|
||||
|
||||
</h:head>
|
||||
|
||||
<h:body >
|
||||
<h:form>
|
||||
<h:commandLink value="temperature converter"
|
||||
action="temperature" />
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<h:commandLink value="test wrapper ajax"
|
||||
action="wrapper" />
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<h:commandLink value="test all ajax"
|
||||
action="multipleEventListeners" />
|
||||
</h:form>
|
||||
|
||||
</h:body>
|
||||
</html>
|
@@ -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:f="http://xmlns.jcp.org/jsf/core">
|
||||
<h:head>
|
||||
<title>Facelet Title</title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<h:form>
|
||||
<h:commandButton value="Start navigation"
|
||||
style="#{AJAXBean.buttonRed?'background-color:red':''}"
|
||||
action="landingPage.jsf">
|
||||
<f:ajax execute="@this" render="@form" />
|
||||
|
||||
<f:ajax event="mouseover" execute="@this" render="@this :messages"
|
||||
listener="#{AJAXBean.mouseOverListener}" />
|
||||
<f:ajax event="mouseout" execute="@this" render="@this :messages"
|
||||
listener="#{AJAXBean.mouseOutListener}" />
|
||||
</h:commandButton>
|
||||
|
||||
<h:selectOneMenu value="#{AJAXBean.brand}" id="brandID"
|
||||
onchange="console.log('before onChange');ajax:AJAXBean.onChange();javascript:console.log('afterOnChange')"
|
||||
onblur="console.log('blur');ajax:AJAXBean.onBlur()"
|
||||
onfocus="console.log('focus');ajax:AJAXBean.onFocus()"
|
||||
onclick="console.log('click');ajax:AJAXBean.onClick()"
|
||||
ondblclick="console.log('dblclick');ajax:AJAXBean.onDblClick()"
|
||||
onkeydown="console.log('keyd own');ajax:AJAXBean.onKeyDown()"
|
||||
onkeyup="console.log('key up');ajax:AJAXBean.onKeyUp()"
|
||||
onkeypress="console.log('key press');ajax:AJAXBean.onKeyPress()"
|
||||
onmousedown="console.log('mouse down');ajax:AJAXBean.onMouseDown();"
|
||||
onmouseout="console.log('mouse out');ajax:AJAXBean.onMouseOut();"
|
||||
onmouseup="console.log('mouse up');ajax:AJAXBean.onMouseUp();"
|
||||
>
|
||||
|
||||
<f:selectItem itemLabel="(Please select)" itemValue="0" />
|
||||
<f:selectItem itemLabel="Fiat" itemValue="1" />
|
||||
<f:selectItem itemLabel="Honda" itemValue="2" />
|
||||
<f:selectItem itemLabel="Opel" itemValue="3" />
|
||||
</h:selectOneMenu>
|
||||
<br/><br/>
|
||||
<!-- add the same AJAX processing to each component of a field group -->
|
||||
<f:ajax execute="@form" render="@form"
|
||||
listener="#{AJAXBean.facetListener}">
|
||||
<h:outputLabel for="ageID"
|
||||
value="Enter your age (18-65)"/>
|
||||
<h:inputText value="#{AJAXBean.age}" id="ageID">
|
||||
<f:validateLongRange minimum="18" maximum="65" />
|
||||
</h:inputText>
|
||||
<h:commandButton value="validate age" />
|
||||
<h:message for="ageID" id="ageMessage"/>
|
||||
|
||||
<br/><br/>
|
||||
<h:outputLabel for="nameID"
|
||||
value="Enter your first name (3 -20 letters)"/>
|
||||
<h:inputText value="#{AJAXBean.name}" id="nameID"
|
||||
required="true">
|
||||
<f:validateLength minimum="3" maximum="20" />
|
||||
</h:inputText>
|
||||
<h:commandButton value="validate name" />
|
||||
<h:message for="nameID" id="nameMessage"/>
|
||||
</f:ajax>
|
||||
|
||||
</h:form >
|
||||
|
||||
</h:body>
|
||||
</html>
|
||||
|
@@ -0,0 +1,67 @@
|
||||
body {
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
a:hover {
|
||||
color: red
|
||||
}
|
||||
h1,h2,h3 {
|
||||
text-align: center;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
color: black;
|
||||
}
|
||||
h1.title {
|
||||
display: table;
|
||||
margin: auto;
|
||||
background-color: #afc4d6;
|
||||
border-width: 4px;
|
||||
border-style: outset;
|
||||
border-color: #9fd1ff;
|
||||
padding: 5px 8px;
|
||||
letter-spacing: -.025em;
|
||||
}
|
||||
.formTable {
|
||||
display: table;
|
||||
}
|
||||
/* If prompt and input are in two cells of one row, the prompt will be R-aligned. */
|
||||
.formTable td:first-child {
|
||||
text-align: right;
|
||||
}
|
||||
/* Third table cell shows the error message, so make it bold and red. Used in validation examples that have h:message. */
|
||||
.formTable td:nth-child(3) {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
th { background-color: #afc4d6;
|
||||
font-size: 110%;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
legend {
|
||||
font-weight: bold;
|
||||
color: black;
|
||||
background-color: #afc4d6;
|
||||
border: 1px solid #1a55bf;
|
||||
padding: 3px 5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
fieldset {
|
||||
border-radius: 6px;
|
||||
display: block;
|
||||
}
|
||||
input, textarea {
|
||||
background-color: #ecedf2;
|
||||
text-align: left;
|
||||
}
|
||||
input[type="checkbox"] {
|
||||
background-color: transparent; /* For IE -- doesn't matter in FF or Chrome */
|
||||
}
|
||||
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
|
||||
background-color: #9fd1ff;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
/* So that in Chrome and IE, the bullets are next to the text in centered lists. Already OK in Firefox. */
|
||||
[align="center"] li {
|
||||
list-style-position: inside;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,13 @@
|
||||
function onStatusChange( data )
|
||||
{
|
||||
var spinner = document.getElementById("anImage");
|
||||
var status = data.status;
|
||||
if (status === "begin")
|
||||
{
|
||||
spinner.style.display = "inline";
|
||||
}
|
||||
else
|
||||
{
|
||||
spinner.style.display = "none";
|
||||
}
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
|
||||
function onStatusChange(data)
|
||||
{
|
||||
var spinner = document.getElementById("spinner");
|
||||
var status = data.status;
|
||||
if (status === "begin") {
|
||||
spinner.style.display = "inline";
|
||||
} else
|
||||
{
|
||||
spinner.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function showWorkingIndicator(data)
|
||||
{
|
||||
showIndicatorRegion(data,
|
||||
"workingIndicator",
|
||||
"slowJSF:ajaxMessage2");
|
||||
}
|
||||
|
||||
function showIndicatorRegion(data, spinnerRegionId, messageRegionId)
|
||||
{
|
||||
if (data.status == "begin")
|
||||
{
|
||||
clearExistingText(messageRegionId);
|
||||
showElement(spinnerRegionId);
|
||||
}
|
||||
else if (data.status == "complete")
|
||||
{
|
||||
hideElement(spinnerRegionId);
|
||||
}
|
||||
}
|
||||
|
||||
function clearExistingText(id)
|
||||
{
|
||||
document.getElementById(id).innerHTML = "";
|
||||
}
|
||||
|
||||
function showElement(id)
|
||||
{
|
||||
document.getElementById(id).style.display = "block";
|
||||
}
|
||||
|
||||
function hideElement(id)
|
||||
{
|
||||
document.getElementById(id).style.display = "none";
|
||||
}
|
||||
|
@@ -0,0 +1,30 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||
<h:head>
|
||||
<title>Facelet Title</title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<h:form>
|
||||
|
||||
<h2>On-the-Fly Temperature Converter …</h2>
|
||||
Temperature in Fahrenheit:
|
||||
<h:inputText value="#{testBean.farheneitTemperature}">
|
||||
<f:ajax event="keyup" execute="@this"
|
||||
render="cField"/>
|
||||
<f:validateRegex pattern = "[-+]?[0-9]*\.?[0-9]"/>
|
||||
|
||||
</h:inputText><br/>
|
||||
<h2>
|
||||
Temperature in Celsius:
|
||||
<h:outputText value="#{testBean.celciusTemperature}"
|
||||
id="cField"/>
|
||||
|
||||
</h2>
|
||||
</h:form>
|
||||
|
||||
</h:body>
|
||||
</html>
|
||||
|
@@ -0,0 +1,43 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||
<h:head>
|
||||
<title>Facelet Title</title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<h:form>
|
||||
<f:ajax event="keyup" execute="tempID milesID"
|
||||
render="cField kField">
|
||||
|
||||
<h2>Ajax tag as Wrapper </h2>
|
||||
Temperature in Fahrenheit:
|
||||
<h:inputText id="tempID" value="#{testBean.farheneitTemperature}">
|
||||
<f:validateRegex pattern = "[-+]?[0-9]*\.?[0-9]"/>
|
||||
</h:inputText>
|
||||
<br/>
|
||||
Miles:
|
||||
<h:inputText id="milesID" value="#{testBean.miles}">
|
||||
<f:validateRegex pattern = "[-+]?[0-9]*\.?[0-9]"/>
|
||||
</h:inputText><br/>
|
||||
|
||||
</f:ajax>
|
||||
|
||||
<h2>
|
||||
Temperature in Celsius:
|
||||
<h:outputText value="#{testBean.celciusTemperature}"
|
||||
id="cField"/>
|
||||
|
||||
</h2>
|
||||
|
||||
<h2>
|
||||
Kilometers:
|
||||
<h:outputText value="#{testBean.milesToKilometers()}"
|
||||
id="kField"/>
|
||||
|
||||
</h2>
|
||||
</h:form>
|
||||
</h:body>
|
||||
</html>
|
||||
|
BIN
Semester 3/Examples/ajax-examples/Ajax3-Tags-Testing.zip
Normal file
BIN
Semester 3/Examples/ajax-examples/Ajax3-Tags-Testing.zip
Normal file
Binary file not shown.
@@ -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>
|
77
Semester 3/Examples/ajax-examples/Ajax3-Tags-Testing/pom.xml
Normal file
77
Semester 3/Examples/ajax-examples/Ajax3-Tags-Testing/pom.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>asdv</groupId>
|
||||
<artifactId>Ajax3-Tags-Testing</artifactId>
|
||||
<version>1</version>
|
||||
<packaging>war</packaging>
|
||||
<name>Ajax3-Tags-Testing-1</name>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<jakartaee>10.0.0</jakartaee>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>jakarta.platform</groupId>
|
||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||
<version>${jakartaee}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
<compilerArguments>
|
||||
<endorseddirs>${endorsed.dir}</endorseddirs>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${endorsed.dir}</outputDirectory>
|
||||
<silent>true</silent>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>jakarta.platform</groupId>
|
||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||
<version>${jakartaee}</version>
|
||||
<type>jar</type>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@@ -0,0 +1,13 @@
|
||||
package asdv.ajax3.tags.testing;
|
||||
|
||||
import jakarta.ws.rs.ApplicationPath;
|
||||
import jakarta.ws.rs.core.Application;
|
||||
|
||||
/**
|
||||
* Configures Jakarta RESTful Web Services for the application.
|
||||
* @author Juneau
|
||||
*/
|
||||
@ApplicationPath("resources")
|
||||
public class JakartaRestConfiguration extends Application {
|
||||
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package asdv.ajax3.tags.testing.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,68 @@
|
||||
package beans;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import jakarta.enterprise.context.RequestScoped;
|
||||
import jakarta.inject.Named;
|
||||
@Named
|
||||
@RequestScoped
|
||||
public class AjaxBean
|
||||
{
|
||||
private static final Logger logger
|
||||
= Logger.getLogger(AjaxBean.class.getName());
|
||||
private String firstName = "default";
|
||||
private String lastName;
|
||||
private String phone;
|
||||
private String age;
|
||||
private String address;
|
||||
|
||||
public String getFirstName()
|
||||
{
|
||||
return firstName;
|
||||
}
|
||||
public void setFirstName(String firstName)
|
||||
{
|
||||
this.firstName = firstName;
|
||||
}
|
||||
public String getLastName()
|
||||
{
|
||||
return lastName;
|
||||
}
|
||||
public void setLastName(String lastName)
|
||||
{
|
||||
this.lastName = lastName;
|
||||
}
|
||||
public String getPhone()
|
||||
{
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone)
|
||||
{
|
||||
this.phone = phone;
|
||||
}
|
||||
public String getAge()
|
||||
{
|
||||
return age;
|
||||
}
|
||||
public void setAge(String age)
|
||||
{
|
||||
this.age = age;
|
||||
}
|
||||
public String getAddress()
|
||||
{
|
||||
return address;
|
||||
}
|
||||
public void setAddress(String address)
|
||||
{
|
||||
this.address = address;
|
||||
}
|
||||
public void ajaxAction(String executeNrender)
|
||||
{
|
||||
System.out.println(executeNrender);
|
||||
logger.log(Level.INFO, "First Name = {0}", this.firstName);
|
||||
logger.log(Level.INFO, "Last Name = {0}", this.lastName);
|
||||
logger.log(Level.INFO, "Phone = {0}", this.phone);
|
||||
logger.log(Level.INFO, "Age = {0}", this.age);
|
||||
logger.log(Level.INFO, "Address = {0}", this.address);
|
||||
System.out.println("--------------------------------------");
|
||||
}
|
||||
}
|
@@ -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,121 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||
<h:head>
|
||||
<title></title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<hr/>
|
||||
AJAX - execute=form a render=@form
|
||||
<h:form>
|
||||
First Name <h:inputText value="#{ajaxBean.firstName}"/>
|
||||
Last Name <h:inputText value="#{ajaxBean.lastName}"/>
|
||||
Phone: <h:inputText value="#{ajaxBean.phone}"/>
|
||||
Age: <h:inputText value="#{ajaxBean.age}"/>
|
||||
Address: <h:inputText value="#{ajaxBean.address}"/>
|
||||
<h:commandButton value="Say Hello" action='#{ajaxBean.ajaxAction("execute=form a render=@form")}'>
|
||||
<f:ajax execute="@form" render="@form"/>
|
||||
</h:commandButton>
|
||||
|
||||
<h:panelGrid columns="6">
|
||||
<h:outputText style="font-weight: bold;" value="@form"/>
|
||||
<h:outputText style="color:red;" value="First Name: #{ajaxBean.firstName}"/>
|
||||
<h:outputText style="color:blue;" value="Last Name: #{ajaxBean.lastName}"/>
|
||||
<h:outputText style="color:green;" value="Phone: #{ajaxBean.phone}"/>
|
||||
<h:outputText style="color:brown;" value="Age: #{ajaxBean.age}"/>
|
||||
<h:outputText style="color: blueviolet" value="Address: #{ajaxBean.address}"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - execute=@none , render=@form
|
||||
<h:form>
|
||||
First Name: <h:inputText value="#{ajaxBean.firstName}"/>
|
||||
Last Name: <h:inputText value="#{ajaxBean.lastName}"/>
|
||||
Phone: <h:inputText value="#{ajaxBean.phone}"/>
|
||||
Age: <h:inputText value="#{ajaxBean.age}"/>
|
||||
Address: <h:inputText value="#{ajaxBean.address}"/>
|
||||
<h:commandButton value="Say Hello" action="#{ajaxBean.ajaxAction('execute=@none render=@form')}">
|
||||
<f:ajax execute="@none" render="@form"/>
|
||||
</h:commandButton>
|
||||
<h:panelGrid columns="6">
|
||||
<h:outputText style="font-weight: bold;" value="@form"/>
|
||||
<h:outputText style="color:red;" value="First Name: #{ajaxBean.firstName}"/>
|
||||
<h:outputText style="color:blue;" value="Last Name: #{ajaxBean.lastName}"/>
|
||||
<h:outputText style="color:green;" value="Phone: #{ajaxBean.phone}"/>
|
||||
<h:outputText style="color:brown;" value="Age: #{ajaxBean.age}"/>
|
||||
<h:outputText style="color: blueviolet" value="Address: #{ajaxBean.address}"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - execute=@this render=@form
|
||||
<h:form>
|
||||
First Name <h:inputText value="#{ajaxBean.firstName}"/>
|
||||
Last Name <h:inputText value="#{ajaxBean.lastName}"/>
|
||||
Phone: <h:inputText value="#{ajaxBean.phone}"/>
|
||||
Age: <h:inputText value="#{ajaxBean.age}"/>
|
||||
Address: <h:inputText value="#{ajaxBean.address}"/>
|
||||
<h:commandButton value="Say Hello" action='#{ajaxBean.ajaxAction("execute=@this render=@form")}'>
|
||||
<f:ajax execute="@this" render="@form"/>
|
||||
</h:commandButton>
|
||||
<hr/>
|
||||
<h:panelGrid columns="6">
|
||||
<h:outputText style="font-weight: bold;" value="@this"/>
|
||||
<h:outputText value="Name: #{ajaxBean.firstName}"/>
|
||||
<h:outputText value="Surname: #{ajaxBean.lastName}"/>
|
||||
<h:outputText value="Phone: #{ajaxBean.phone}"/>
|
||||
<h:outputText value="Age: #{ajaxBean.age}"/>
|
||||
<h:outputText value="Address: #{ajaxBean.address}"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - identifiers
|
||||
<h:form>
|
||||
First Name <h:inputText value="#{ajaxBean.firstName}"/>
|
||||
Last Name <h:inputText id="nameInputId" value="#{ajaxBean.lastName}"/>
|
||||
Phone: <h:inputText id="phoneInputId" value="#{ajaxBean.phone}"/>
|
||||
Age: <h:inputText value="#{ajaxBean.age}"/>
|
||||
Address: <h:inputText id="addressInputId" value="#{ajaxBean.address}"/>
|
||||
<h:commandButton value="Say Hello" action="#{ajaxBean.ajaxAction('identifiers')}">
|
||||
<f:ajax execute="nameInputId phoneInputId addressInputId" render="nameOutputId phoneOutputId ageOutputId"/>
|
||||
</h:commandButton>
|
||||
<hr/>
|
||||
<h:panelGrid columns="6">
|
||||
<h:outputText style="font-weight: bold;" value="identifiers"/>
|
||||
<h:outputText style="color:red;" value="First Name: #{ajaxBean.firstName}"/>
|
||||
<h:outputText id="nameOutputId" style="color:blue;" value="Last Name: #{ajaxBean.lastName}"/>
|
||||
<h:outputText id="phoneOutputId" style="color:green;" value="Phone: #{ajaxBean.phone}"/>
|
||||
<h:outputText id="ageOutputId" style="color:brown;" value="Age: #{ajaxBean.age}"/>
|
||||
<h:outputText style="color: blueviolet" value="Address: #{ajaxBean.address}"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - execute=@all render=@all
|
||||
<hr/>
|
||||
<h:form>
|
||||
First Name <h:inputText value="#{ajaxBean.firstName}"/>
|
||||
Last Name <h:inputText value="#{ajaxBean.lastName}"/>
|
||||
Phone: <h:inputText value="#{ajaxBean.phone}"/>
|
||||
Age: <h:inputText value="#{ajaxBean.age}"/>
|
||||
Address: <h:inputText value="#{ajaxBean.address}"/>
|
||||
<h:commandButton value="Say Hello" action="#{ajaxBean.ajaxAction('execute=@all render=@all')}">
|
||||
<f:ajax execute="@all" render="@all"/>
|
||||
</h:commandButton>
|
||||
<hr/>
|
||||
<h:panelGrid columns="6">
|
||||
<h:outputText style="font-weight: bold;" value="@all"/>
|
||||
<h:outputText style="color:red;" value="First Name: #{ajaxBean.firstName}"/>
|
||||
<h:outputText style="color:blue;" value="Last Name: #{ajaxBean.lastName}"/>
|
||||
<h:outputText style="color:green;" value="Phone: #{ajaxBean.phone}"/>
|
||||
<h:outputText style="color:brown;" value="Age: #{ajaxBean.age}"/>
|
||||
<h:outputText style="color: blueviolet" value="Address: #{ajaxBean.address}"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
|
||||
</h:body>
|
||||
</html>
|
Binary file not shown.
@@ -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,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>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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,121 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||
<h:head>
|
||||
<title></title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<hr/>
|
||||
AJAX - execute=form a render=@form
|
||||
<h:form>
|
||||
First Name <h:inputText value="#{ajaxBean.firstName}"/>
|
||||
Last Name <h:inputText value="#{ajaxBean.lastName}"/>
|
||||
Phone: <h:inputText value="#{ajaxBean.phone}"/>
|
||||
Age: <h:inputText value="#{ajaxBean.age}"/>
|
||||
Address: <h:inputText value="#{ajaxBean.address}"/>
|
||||
<h:commandButton value="Say Hello" action='#{ajaxBean.ajaxAction("execute=form a render=@form")}'>
|
||||
<f:ajax execute="@form" render="@form"/>
|
||||
</h:commandButton>
|
||||
|
||||
<h:panelGrid columns="6">
|
||||
<h:outputText style="font-weight: bold;" value="@form"/>
|
||||
<h:outputText style="color:red;" value="First Name: #{ajaxBean.firstName}"/>
|
||||
<h:outputText style="color:blue;" value="Last Name: #{ajaxBean.lastName}"/>
|
||||
<h:outputText style="color:green;" value="Phone: #{ajaxBean.phone}"/>
|
||||
<h:outputText style="color:brown;" value="Age: #{ajaxBean.age}"/>
|
||||
<h:outputText style="color: blueviolet" value="Address: #{ajaxBean.address}"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - execute=@none , render=@form
|
||||
<h:form>
|
||||
First Name: <h:inputText value="#{ajaxBean.firstName}"/>
|
||||
Last Name: <h:inputText value="#{ajaxBean.lastName}"/>
|
||||
Phone: <h:inputText value="#{ajaxBean.phone}"/>
|
||||
Age: <h:inputText value="#{ajaxBean.age}"/>
|
||||
Address: <h:inputText value="#{ajaxBean.address}"/>
|
||||
<h:commandButton value="Say Hello" action="#{ajaxBean.ajaxAction('execute=@none render=@form')}">
|
||||
<f:ajax execute="@none" render="@form"/>
|
||||
</h:commandButton>
|
||||
<h:panelGrid columns="6">
|
||||
<h:outputText style="font-weight: bold;" value="@form"/>
|
||||
<h:outputText style="color:red;" value="First Name: #{ajaxBean.firstName}"/>
|
||||
<h:outputText style="color:blue;" value="Last Name: #{ajaxBean.lastName}"/>
|
||||
<h:outputText style="color:green;" value="Phone: #{ajaxBean.phone}"/>
|
||||
<h:outputText style="color:brown;" value="Age: #{ajaxBean.age}"/>
|
||||
<h:outputText style="color: blueviolet" value="Address: #{ajaxBean.address}"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - execute=@this render=@form
|
||||
<h:form>
|
||||
First Name <h:inputText value="#{ajaxBean.firstName}"/>
|
||||
Last Name <h:inputText value="#{ajaxBean.lastName}"/>
|
||||
Phone: <h:inputText value="#{ajaxBean.phone}"/>
|
||||
Age: <h:inputText value="#{ajaxBean.age}"/>
|
||||
Address: <h:inputText value="#{ajaxBean.address}"/>
|
||||
<h:commandButton value="Say Hello" action='#{ajaxBean.ajaxAction("execute=@this render=@form")}'>
|
||||
<f:ajax execute="@this" render="@form"/>
|
||||
</h:commandButton>
|
||||
<hr/>
|
||||
<h:panelGrid columns="6">
|
||||
<h:outputText style="font-weight: bold;" value="@this"/>
|
||||
<h:outputText value="Name: #{ajaxBean.firstName}"/>
|
||||
<h:outputText value="Surname: #{ajaxBean.lastName}"/>
|
||||
<h:outputText value="Phone: #{ajaxBean.phone}"/>
|
||||
<h:outputText value="Age: #{ajaxBean.age}"/>
|
||||
<h:outputText value="Address: #{ajaxBean.address}"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - identifiers
|
||||
<h:form>
|
||||
First Name <h:inputText value="#{ajaxBean.firstName}"/>
|
||||
Last Name <h:inputText id="nameInputId" value="#{ajaxBean.lastName}"/>
|
||||
Phone: <h:inputText id="phoneInputId" value="#{ajaxBean.phone}"/>
|
||||
Age: <h:inputText value="#{ajaxBean.age}"/>
|
||||
Address: <h:inputText id="addressInputId" value="#{ajaxBean.address}"/>
|
||||
<h:commandButton value="Say Hello" action="#{ajaxBean.ajaxAction('identifiers')}">
|
||||
<f:ajax execute="nameInputId phoneInputId addressInputId" render="nameOutputId phoneOutputId ageOutputId"/>
|
||||
</h:commandButton>
|
||||
<hr/>
|
||||
<h:panelGrid columns="6">
|
||||
<h:outputText style="font-weight: bold;" value="identifiers"/>
|
||||
<h:outputText style="color:red;" value="First Name: #{ajaxBean.firstName}"/>
|
||||
<h:outputText id="nameOutputId" style="color:blue;" value="Last Name: #{ajaxBean.lastName}"/>
|
||||
<h:outputText id="phoneOutputId" style="color:green;" value="Phone: #{ajaxBean.phone}"/>
|
||||
<h:outputText id="ageOutputId" style="color:brown;" value="Age: #{ajaxBean.age}"/>
|
||||
<h:outputText style="color: blueviolet" value="Address: #{ajaxBean.address}"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - execute=@all render=@all
|
||||
<hr/>
|
||||
<h:form>
|
||||
First Name <h:inputText value="#{ajaxBean.firstName}"/>
|
||||
Last Name <h:inputText value="#{ajaxBean.lastName}"/>
|
||||
Phone: <h:inputText value="#{ajaxBean.phone}"/>
|
||||
Age: <h:inputText value="#{ajaxBean.age}"/>
|
||||
Address: <h:inputText value="#{ajaxBean.address}"/>
|
||||
<h:commandButton value="Say Hello" action="#{ajaxBean.ajaxAction('execute=@all render=@all')}">
|
||||
<f:ajax execute="@all" render="@all"/>
|
||||
</h:commandButton>
|
||||
<hr/>
|
||||
<h:panelGrid columns="6">
|
||||
<h:outputText style="font-weight: bold;" value="@all"/>
|
||||
<h:outputText style="color:red;" value="First Name: #{ajaxBean.firstName}"/>
|
||||
<h:outputText style="color:blue;" value="Last Name: #{ajaxBean.lastName}"/>
|
||||
<h:outputText style="color:green;" value="Phone: #{ajaxBean.phone}"/>
|
||||
<h:outputText style="color:brown;" value="Age: #{ajaxBean.age}"/>
|
||||
<h:outputText style="color: blueviolet" value="Address: #{ajaxBean.address}"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
|
||||
</h:body>
|
||||
</html>
|
@@ -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>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
#Generated by Maven
|
||||
#Tue Jan 23 12:48:16 CST 2024
|
||||
groupId=asdv
|
||||
artifactId=Ajax3-Tags-Testing
|
||||
version=1
|
@@ -0,0 +1,3 @@
|
||||
beans/AjaxBean.class
|
||||
asdv/ajax3/tags/testing/JakartaRestConfiguration.class
|
||||
asdv/ajax3/tags/testing/resources/JakartaEE10Resource.class
|
@@ -0,0 +1,3 @@
|
||||
/home/caleb/ASDV-WebDev/Semester 2/Exams/Ajax3-Tags-Testing/src/main/java/asdv/ajax3/tags/testing/JakartaRestConfiguration.java
|
||||
/home/caleb/ASDV-WebDev/Semester 2/Exams/Ajax3-Tags-Testing/src/main/java/beans/AjaxBean.java
|
||||
/home/caleb/ASDV-WebDev/Semester 2/Exams/Ajax3-Tags-Testing/src/main/java/asdv/ajax3/tags/testing/resources/JakartaEE10Resource.java
|
BIN
Semester 3/Examples/ajax-examples/Ajax4Listener.zip
Normal file
BIN
Semester 3/Examples/ajax-examples/Ajax4Listener.zip
Normal file
Binary file not shown.
@@ -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>
|
77
Semester 3/Examples/ajax-examples/Ajax4Listener/pom.xml
Normal file
77
Semester 3/Examples/ajax-examples/Ajax4Listener/pom.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>asdv</groupId>
|
||||
<artifactId>Ajax4Listener</artifactId>
|
||||
<version>1</version>
|
||||
<packaging>war</packaging>
|
||||
<name>Ajax4Listener-1</name>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<jakartaee>10.0.0</jakartaee>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>jakarta.platform</groupId>
|
||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||
<version>${jakartaee}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
<compilerArguments>
|
||||
<endorseddirs>${endorsed.dir}</endorseddirs>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${endorsed.dir}</outputDirectory>
|
||||
<silent>true</silent>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>jakarta.platform</groupId>
|
||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||
<version>${jakartaee}</version>
|
||||
<type>jar</type>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@@ -0,0 +1,13 @@
|
||||
package asdv.ajax4listener;
|
||||
|
||||
import jakarta.ws.rs.ApplicationPath;
|
||||
import jakarta.ws.rs.core.Application;
|
||||
|
||||
/**
|
||||
* Configures Jakarta RESTful Web Services for the application.
|
||||
* @author Juneau
|
||||
*/
|
||||
@ApplicationPath("resources")
|
||||
public class JakartaRestConfiguration extends Application {
|
||||
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package asdv.ajax4listener.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,52 @@
|
||||
package beans;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.enterprise.context.RequestScoped;
|
||||
import jakarta.faces.event.AjaxBehaviorEvent;
|
||||
|
||||
@Named(value = "ajaxBean")
|
||||
@RequestScoped
|
||||
public class AjaxBean
|
||||
{
|
||||
|
||||
private static final Logger logger
|
||||
= Logger.getLogger( AjaxBean.class.getName());
|
||||
private String name = "nothing";
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
logger.log(Level.INFO, "Name: {0}", name);
|
||||
this.name = name;
|
||||
}
|
||||
public void upperCaseNameAction()
|
||||
{
|
||||
logger.log(Level.INFO, "AJAX action ");
|
||||
name = name.toUpperCase();
|
||||
logger.log(Level.INFO, "Name: {0}", name);
|
||||
}
|
||||
public void upperCaseName()
|
||||
{
|
||||
logger.log(Level.INFO, "AJAX listener "
|
||||
+ "without AjaxBehaviorEvent or AJAX action");
|
||||
name = name.toUpperCase();
|
||||
logger.log(Level.INFO, "Name: {0}", name);
|
||||
}
|
||||
|
||||
public void upperCaseNameABE(AjaxBehaviorEvent event)
|
||||
{
|
||||
logger.log(Level.INFO,
|
||||
"AJAX listener with AjaxBehaviorEvent");
|
||||
name = name.toUpperCase();
|
||||
logger.log(Level.INFO, "Name: {0}", name);
|
||||
String[] params = {name, event.getComponent().getId()};
|
||||
logger.log(Level.SEVERE, "Params: {0} {1}", params);
|
||||
}
|
||||
|
||||
}
|
@@ -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"?>
|
||||
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||
<!--
|
||||
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program and the accompanying materials are made available under the
|
||||
terms of the Eclipse Public License v. 2.0, which is available at
|
||||
http://www.eclipse.org/legal/epl-2.0.
|
||||
|
||||
This Source Code may also be made available under the following Secondary
|
||||
Licenses when the conditions for such availability set forth in the
|
||||
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||
version 2 with the GNU Classpath Exception, which is available at
|
||||
https://www.gnu.org/software/classpath/license.html.
|
||||
|
||||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
-->
|
||||
<glassfish-web-app error-url="">
|
||||
<class-loader delegate="true"/>
|
||||
<jsp-config>
|
||||
<property name="keepgenerated" value="true">
|
||||
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||
</property>
|
||||
</jsp-config>
|
||||
</glassfish-web-app>
|
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app version="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,42 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||
<h:head>
|
||||
<title>Facelet Title</title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<hr/>
|
||||
AJAX - using h:commandButton action attribute
|
||||
<h:form>
|
||||
<h:inputText value="#{ajaxBean.name}"/>
|
||||
<h:commandButton value="Send" action="#{ajaxBean.upperCaseNameAction()}">
|
||||
<f:ajax execute="@form" render="@form"/>
|
||||
</h:commandButton>
|
||||
</h:form>
|
||||
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - listener (without AjaxBehaviorEvent)
|
||||
<h:form>
|
||||
<h:inputText value="#{ajaxBean.name}"/>
|
||||
<h:commandButton value="Send">
|
||||
<f:ajax listener="#{ajaxBean.upperCaseName()}"
|
||||
execute="@form" render="@form"/>
|
||||
</h:commandButton>
|
||||
</h:form>
|
||||
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - listener (with AjaxBehaviorEvent)
|
||||
<h:form>
|
||||
<h:inputText value="#{ajaxBean.name}"/>
|
||||
<h:commandButton id="id_button_ajax" value="Send">
|
||||
<f:ajax listener="#{ajaxBean.upperCaseNameABE}"
|
||||
execute="@form" render="@form"/>
|
||||
</h:commandButton>
|
||||
</h:form>
|
||||
<br/><hr/>
|
||||
</h:body>
|
||||
</html>
|
Binary file not shown.
@@ -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,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>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||
<!--
|
||||
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program and the accompanying materials are made available under the
|
||||
terms of the Eclipse Public License v. 2.0, which is available at
|
||||
http://www.eclipse.org/legal/epl-2.0.
|
||||
|
||||
This Source Code may also be made available under the following Secondary
|
||||
Licenses when the conditions for such availability set forth in the
|
||||
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||
version 2 with the GNU Classpath Exception, which is available at
|
||||
https://www.gnu.org/software/classpath/license.html.
|
||||
|
||||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
-->
|
||||
<glassfish-web-app error-url="">
|
||||
<class-loader delegate="true"/>
|
||||
<jsp-config>
|
||||
<property name="keepgenerated" value="true">
|
||||
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||
</property>
|
||||
</jsp-config>
|
||||
</glassfish-web-app>
|
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app version="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,42 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||
<h:head>
|
||||
<title>Facelet Title</title>
|
||||
</h:head>
|
||||
<h:body>
|
||||
<hr/>
|
||||
AJAX - using h:commandButton action attribute
|
||||
<h:form>
|
||||
<h:inputText value="#{ajaxBean.name}"/>
|
||||
<h:commandButton value="Send" action="#{ajaxBean.upperCaseNameAction()}">
|
||||
<f:ajax execute="@form" render="@form"/>
|
||||
</h:commandButton>
|
||||
</h:form>
|
||||
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - listener (without AjaxBehaviorEvent)
|
||||
<h:form>
|
||||
<h:inputText value="#{ajaxBean.name}"/>
|
||||
<h:commandButton value="Send">
|
||||
<f:ajax listener="#{ajaxBean.upperCaseName()}"
|
||||
execute="@form" render="@form"/>
|
||||
</h:commandButton>
|
||||
</h:form>
|
||||
|
||||
<br/>
|
||||
<hr/>
|
||||
AJAX - listener (with AjaxBehaviorEvent)
|
||||
<h:form>
|
||||
<h:inputText value="#{ajaxBean.name}"/>
|
||||
<h:commandButton id="id_button_ajax" value="Send">
|
||||
<f:ajax listener="#{ajaxBean.upperCaseNameABE}"
|
||||
execute="@form" render="@form"/>
|
||||
</h:commandButton>
|
||||
</h:form>
|
||||
<br/><hr/>
|
||||
</h:body>
|
||||
</html>
|
@@ -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>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
#Generated by Maven
|
||||
#Tue Jan 23 13:12:55 CST 2024
|
||||
groupId=asdv
|
||||
artifactId=Ajax4Listener
|
||||
version=1
|
@@ -0,0 +1,3 @@
|
||||
beans/AjaxBean.class
|
||||
asdv/ajax4listener/resources/JakartaEE10Resource.class
|
||||
asdv/ajax4listener/JakartaRestConfiguration.class
|
@@ -0,0 +1,3 @@
|
||||
/home/caleb/ASDV-WebDev/Semester 2/Exams/Ajax4Listener/src/main/java/beans/AjaxBean.java
|
||||
/home/caleb/ASDV-WebDev/Semester 2/Exams/Ajax4Listener/src/main/java/asdv/ajax4listener/resources/JakartaEE10Resource.java
|
||||
/home/caleb/ASDV-WebDev/Semester 2/Exams/Ajax4Listener/src/main/java/asdv/ajax4listener/JakartaRestConfiguration.java
|
Reference in New Issue
Block a user