diff --git a/.gitignore b/.gitignore index dcd8794..d1d7c6e 100644 --- a/.gitignore +++ b/.gitignore @@ -43,5 +43,6 @@ /Semester 2/labEL2_CalebFontenot/target/ /Semester 2/MP2-chapter4_Java20_CalebFontenot/nbproject/private/ /Semester 2/Assignments/SwingTest/target/ - /Semester 2/Assignments/MP2_BusinessLogic_CalebFontenot/target/ +/Semester 2/lab_EL5_CalebFontenot/target/ + diff --git a/Semester 2/lab_EL5_CalebFontenot/13-EL-5.pdf b/Semester 2/lab_EL5_CalebFontenot/13-EL-5.pdf new file mode 100644 index 0000000..e2976d2 Binary files /dev/null and b/Semester 2/lab_EL5_CalebFontenot/13-EL-5.pdf differ diff --git a/Semester 2/lab_EL5_CalebFontenot/nb-configuration.xml b/Semester 2/lab_EL5_CalebFontenot/nb-configuration.xml new file mode 100644 index 0000000..2b8fafd --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/nb-configuration.xml @@ -0,0 +1,21 @@ + + + + + + 10-web + gfv700ee10 + JSP + JDK_11__System_ + + diff --git a/Semester 2/lab_EL5_CalebFontenot/pom.xml b/Semester 2/lab_EL5_CalebFontenot/pom.xml new file mode 100644 index 0000000..d6e3410 --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/pom.xml @@ -0,0 +1,77 @@ + + 4.0.0 + edu.slcc.asdv.caleb + lab_EL5_CalebFontenot + 1.0-SNAPSHOT + war + lab_EL5_CalebFontenot-1.0-SNAPSHOT + + + 11 + 11 + ${project.build.directory}/endorsed + UTF-8 + false + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + jar + + + + + + + + + \ No newline at end of file diff --git a/Semester 2/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/beans/LambdaAction.java b/Semester 2/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/beans/LambdaAction.java new file mode 100644 index 0000000..09800a7 --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/beans/LambdaAction.java @@ -0,0 +1,32 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ + +package edu.slcc.asdv.beans; + +import jakarta.el.ELContext; +import jakarta.el.LambdaExpression; +import jakarta.inject.Named; +import jakarta.enterprise.context.RequestScoped; +import jakarta.faces.context.FacesContext; + +/** + * + * @author caleb + */ +@Named(value="lambdaAction") +@RequestScoped +public class LambdaAction { + + /** Creates a new instance of LambdaAction */ + public LambdaAction() { + } + public Object lambda1(LambdaExpression lambdaExpression) { + // Useful in case of a custom ELContext + FacesContext fc = FacesContext.getCurrentInstance(); + ELContext elContext = fc.getELContext(); + return lambdaExpression.invoke(elContext, 8, 3); + } + +} diff --git a/Semester 2/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/lab_el5_calebfontenot/JakartaRestConfiguration.java b/Semester 2/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/lab_el5_calebfontenot/JakartaRestConfiguration.java new file mode 100644 index 0000000..3f19467 --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/lab_el5_calebfontenot/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package edu.slcc.asdv.caleb.lab_el5_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 { + +} diff --git a/Semester 2/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/lab_el5_calebfontenot/resources/JakartaEE10Resource.java b/Semester 2/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/lab_el5_calebfontenot/resources/JakartaEE10Resource.java new file mode 100644 index 0000000..b9cb61b --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/lab_el5_calebfontenot/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package edu.slcc.asdv.caleb.lab_el5_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(); + } +} diff --git a/Semester 2/lab_EL5_CalebFontenot/src/main/resources/META-INF/persistence.xml b/Semester 2/lab_EL5_CalebFontenot/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..7582bf1 --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/WEB-INF/beans.xml b/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..9dfae34 --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..673cc06 --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/WEB-INF/web.xml b/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcfcd54 --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/index.html b/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/index.html new file mode 100644 index 0000000..3368e9c --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/index.html @@ -0,0 +1,10 @@ + + + + Start Page + + + +

Hello World!

+ + diff --git a/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/index.xhtml b/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/index.xhtml new file mode 100644 index 0000000..47b2b8d --- /dev/null +++ b/Semester 2/lab_EL5_CalebFontenot/src/main/webapp/index.xhtml @@ -0,0 +1,45 @@ + + + + + Facelet Title + + +

Assignment operator, concatenation operator

+ {x = 3}: #{x = 3}
+ {y = x + 5}: #{y = x + 5}
+ {z = x + y}: #{z = x + y}
+ + concatenation operator += {z += x} #{z += x} + +

; semicolon operator

+ {x = 5; y = 3; z = x + y}: #{x = 5; y = 3; z = x + y}
+

lambda expressions and conditional operator

+ {(x->x+1)(3)}: #{(x->x+1)(3)}
+ Declaration and use of lambda variables: #{squareOfNumber = ((x) -> x+x); squareOfNumber(4)}
+ + use of lambda variable outside the initial {}: #{squareOfNumber(5)}
+ + #{min=(x,y) -> (x lt y ? x : y); min(1,2)}
+ #{min(3, 4)}
+ +

call a bean method with EL as lambda expression

+ + #{lambdaAction.lambda1(max = (x,y) -> x gt y ? x : y)}
+ +

Collections as lambda expression

+ set: #{set = {10,20,1,44}}
+ list: #{list = [100,2,20,33]}
+ map: #{map = {"one":1, "two":3, "four":4}}
+ sorting a list descending: #{list.stream().sorted((i,j)->i-j).toList()}
+ sorting a list ascending: #{list.stream().sorted((i,j)->j-i).toList()}
+ +

Traversing a lambda collection

+ +
+
+
+