Caleb Fontenot
af597b18d1
modified: .gitignore modified: Semester 2/Assignments/labEL2_CalebFontenot/target/labEL2_CalebFontenot-1.0-SNAPSHOT.war modified: Semester 2/Assignments/labEL2_CalebFontenot/target/maven-archiver/pom.properties modified: Semester 2/Assignments/labEL2_CalebFontenot/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst modified: Semester 2/Assignments/labEL2_CalebFontenot/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file: Semester 2/Assignments/lab_EL5_CalebFontenot/Printed HTMLs/LambdaAction.html new file: Semester 2/Assignments/lab_EL5_CalebFontenot/Printed HTMLs/index.html modified: Semester 2/Assignments/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/beans/LambdaAction.java modified: Semester 2/Assignments/lab_EL5_CalebFontenot/src/main/webapp/index.xhtml modified: Semester 2/Assignments/lab_EL5_CalebFontenot/target/lab_EL5_CalebFontenot-1.0-SNAPSHOT/index.xhtml new file: Semester 2/ZIPs/lab_EL5_CalebFontenot.zip
80 lines
20 KiB
HTML
80 lines
20 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<title>index.xhtml</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<style type="text/css">
|
|
<!--
|
|
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
|
|
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
|
|
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
|
|
.highlight-caret-row {background-color: #323232}
|
|
.expression-language {background-color: #232525}
|
|
.ST8 {color: #cc7832; background-color: #232525}
|
|
.ST0 {color: #628fb5}
|
|
.ST2 {color: #287bde}
|
|
.ST6 {color: #505050; background-color: #232525}
|
|
.ST7 {color: #6897bb; background-color: #232525}
|
|
.ST9 {color: #6a8759; background-color: #232525}
|
|
.ST5 {color: #a5c261}
|
|
.ST3 {color: #e8bf6a}
|
|
.ST1 {color: #505050}
|
|
.ST4 {color: #bababa}
|
|
-->
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<table width="100%"><tr><td align="center">/home/caleb/ASDV-WebDev/Semester 2/Assignments/lab_EL5_CalebFontenot/src/main/webapp/index.xhtml</td></tr></table>
|
|
<pre>
|
|
<span class="highlight-caret-row"><?xml version='1.0' encoding='UTF-8' ?></span>
|
|
<span class="ST0"><!DOCTYPE</span> <span class="ST0">html</span> <span class="ST0">PUBLIC</span> <span class="ST0">"-//W3C//DTD</span> <span class="ST0">XHTML</span> <span class="ST0">1.0</span> <span class="ST0">Transitional//EN"</span> <span class="ST0">"</span><span class="ST2">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</span><span class="ST0">"</span><span class="ST0">></span>
|
|
<span class="ST3"><</span><span class="ST3">html</span> <span class="ST4">xmlns</span><span class="ST4">=</span><span class="ST5">"</span><span class="ST2">http://www.w3.org/1999/xhtml</span><span class="ST5">"</span>
|
|
<span class="ST4">xmlns:h</span><span class="ST4">=</span><span class="ST5">"</span><span class="ST2">http://xmlns.jcp.org/jsf/html</span><span class="ST5">"</span>
|
|
<span class="ST4">xmlns:ui</span><span class="ST4">=</span><span class="ST5">"</span><span class="ST2">http://xmlns.jcp.org/jsf/facelets</span><span class="ST5">"</span><span class="ST3">></span>
|
|
<span class="ST3"><</span><span class="ST3">h:head</span><span class="ST3">></span>
|
|
<span class="ST3"><</span><span class="ST3">title</span><span class="ST3">></span>Facelet Title<span class="ST3"></</span><span class="ST3">title</span><span class="ST3">></span>
|
|
<span class="ST3"></</span><span class="ST3">h:head</span><span class="ST3">></span>
|
|
<span class="ST3"><</span><span class="ST3">h:body</span><span class="ST3">></span>
|
|
<span class="ST3"><</span><span class="ST3">h3</span><span class="ST3">></span>Assignment operator, concatenation operator<span class="ST3"></</span><span class="ST3">h3</span><span class="ST3">></span>
|
|
{x = 3}: <span class="expression-language">#{</span><span class="expression-language">x</span> <span class="expression-language">=</span> <span class="ST7">3</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
{y = x + 5}: <span class="expression-language">#{</span><span class="expression-language">y</span> <span class="expression-language">=</span> <span class="expression-language">x</span> <span class="expression-language">+</span> <span class="ST7">5</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
{z = x + y}: <span class="expression-language">#{</span><span class="expression-language">z</span> <span class="expression-language">=</span> <span class="expression-language">x</span> <span class="expression-language">+</span> <span class="expression-language">y</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
|
|
concatenation operator += {z += x} <span class="expression-language">#{</span><span class="expression-language">z</span> <span class="expression-language">+=</span> <span class="expression-language">x</span><span class="expression-language">}</span>
|
|
|
|
<span class="ST3"><</span><span class="ST3">h3</span><span class="ST3">></span>; semicolon operator<span class="ST3"></</span><span class="ST3">h3</span><span class="ST3">></span>
|
|
{x = 5; y = 3; z = x + y}: <span class="expression-language">#{</span><span class="expression-language">x</span> <span class="expression-language">=</span> <span class="ST7">5</span><span class="expression-language">;</span> <span class="expression-language">y</span> <span class="expression-language">=</span> <span class="ST7">3</span><span class="expression-language">;</span> <span class="expression-language">z</span> <span class="expression-language">=</span> <span class="expression-language">x</span> <span class="expression-language">+</span> <span class="expression-language">y</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
<span class="ST3"><</span><span class="ST3">h3</span><span class="ST3">></span>lambda expressions and conditional operator<span class="ST3"></</span><span class="ST3">h3</span><span class="ST3">></span>
|
|
{(x->x+1)(3)}: <span class="expression-language">#{</span><span class="expression-language">(</span><span class="expression-language">x</span><span class="expression-language">-></span><span class="expression-language">x</span><span class="expression-language">+</span><span class="ST7">1</span><span class="expression-language">)</span><span class="expression-language">(</span><span class="ST7">3</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
Declaration and use of lambda variables: <span class="expression-language">#{</span><span class="expression-language">squareOfNumber</span> <span class="expression-language">=</span> <span class="expression-language">(</span><span class="expression-language">(</span><span class="expression-language">x</span><span class="expression-language">)</span> <span class="expression-language">-></span> <span class="expression-language">x</span><span class="expression-language">+</span><span class="expression-language">x</span><span class="expression-language">)</span><span class="expression-language">;</span> <span class="expression-language">squareOfNumber</span><span class="expression-language">(</span><span class="ST7">4</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
|
|
use of lambda variable outside the initial {}: <span class="expression-language">#{</span><span class="expression-language">squareOfNumber</span><span class="expression-language">(</span><span class="ST7">5</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
|
|
<span class="expression-language">#{</span><span class="expression-language">min</span><span class="expression-language">=</span><span class="expression-language">(</span><span class="expression-language">x</span><span class="expression-language">,</span><span class="expression-language">y</span><span class="expression-language">)</span> <span class="expression-language">-></span> <span class="expression-language">(</span><span class="expression-language">x</span> <span class="ST8">lt</span> <span class="expression-language">y</span> <span class="expression-language">?</span> <span class="expression-language">x</span> <span class="expression-language">:</span> <span class="expression-language">y</span><span class="expression-language">)</span><span class="expression-language">;</span> <span class="expression-language">min</span><span class="expression-language">(</span><span class="ST7">1</span><span class="expression-language">,</span><span class="ST7">2</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
<span class="expression-language">#{</span><span class="expression-language">min</span><span class="expression-language">(</span><span class="ST7">3</span><span class="expression-language">,</span> <span class="ST7">4</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
|
|
<span class="ST3"><</span><span class="ST3">h3</span><span class="ST3">></span> call a bean method with EL as lambda expression<span class="ST3"></</span><span class="ST3">h3</span><span class="ST3">></span>
|
|
|
|
<span class="expression-language">#{</span><span class="expression-language">lambdaAction</span><span class="expression-language">.</span><span class="expression-language">lambda1</span><span class="expression-language">(</span><span class="expression-language">max</span> <span class="expression-language">=</span> <span class="expression-language">(</span><span class="expression-language">x</span><span class="expression-language">,</span><span class="expression-language">y</span><span class="expression-language">)</span> <span class="expression-language">-></span> <span class="expression-language">x</span> <span class="ST8">gt</span> <span class="expression-language">y</span> <span class="expression-language">?</span> <span class="expression-language">x</span> <span class="expression-language">:</span> <span class="expression-language">y</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
|
|
<span class="ST3"><</span><span class="ST3">h3</span><span class="ST3">></span> Collections as lambda expression<span class="ST3"></</span><span class="ST3">h3</span><span class="ST3">></span>
|
|
set: <span class="expression-language">#{</span><span class="expression-language">set</span> <span class="expression-language">=</span> <span class="expression-language">{</span><span class="ST7">10</span><span class="expression-language">,</span><span class="ST7">20</span><span class="expression-language">,</span><span class="ST7">1</span><span class="expression-language">,</span><span class="ST7">44</span><span class="expression-language">}</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
list: <span class="expression-language">#{</span><span class="expression-language">list</span> <span class="expression-language">=</span> <span class="expression-language">[</span><span class="ST7">100</span><span class="expression-language">,</span><span class="ST7">2</span><span class="expression-language">,</span><span class="ST7">20</span><span class="expression-language">,</span><span class="ST7">33</span><span class="expression-language">]</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
map: <span class="expression-language">#{</span><span class="expression-language">map</span> <span class="expression-language">=</span> <span class="expression-language">{</span><span class="ST9">"one"</span><span class="expression-language">:</span><span class="ST7">1</span><span class="expression-language">,</span> <span class="ST9">"two"</span><span class="expression-language">:</span><span class="ST7">3</span><span class="expression-language">,</span> <span class="ST9">"four"</span><span class="expression-language">:</span><span class="ST7">4</span><span class="expression-language">}</span><span class="expression-language">}</span> <span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
sorting a list descending: <span class="expression-language">#{</span><span class="expression-language">list</span><span class="expression-language">.</span><span class="expression-language">stream</span><span class="expression-language">(</span><span class="expression-language">)</span><span class="expression-language">.</span><span class="expression-language">sorted</span><span class="expression-language">(</span><span class="expression-language">(</span><span class="expression-language">i</span><span class="expression-language">,</span><span class="expression-language">j</span><span class="expression-language">)</span><span class="expression-language">-></span><span class="expression-language">i</span><span class="expression-language">-</span><span class="expression-language">j</span><span class="expression-language">)</span><span class="expression-language">.</span><span class="expression-language">toList</span><span class="expression-language">(</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
sorting a list ascending: <span class="expression-language">#{</span><span class="expression-language">list</span><span class="expression-language">.</span><span class="expression-language">stream</span><span class="expression-language">(</span><span class="expression-language">)</span><span class="expression-language">.</span><span class="expression-language">sorted</span><span class="expression-language">(</span><span class="expression-language">(</span><span class="expression-language">i</span><span class="expression-language">,</span><span class="expression-language">j</span><span class="expression-language">)</span><span class="expression-language">-></span><span class="expression-language">j</span><span class="expression-language">-</span><span class="expression-language">i</span><span class="expression-language">)</span><span class="expression-language">.</span><span class="expression-language">toList</span><span class="expression-language">(</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
|
|
<span class="ST3"><</span><span class="ST3">h3</span><span class="ST3">></span>Traversing a lambda collection<span class="ST3"></</span><span class="ST3">h3</span><span class="ST3">></span>
|
|
<span class="ST3"><</span><span class="ST3">ui:repeat</span> <span class="ST4">value</span><span class="ST4">=</span><span class="ST5">"</span><span class="expression-language">#{</span><span class="expression-language">map</span><span class="expression-language">.</span><span class="expression-language">keySet</span><span class="expression-language">(</span><span class="expression-language">)</span><span class="expression-language">.</span><span class="expression-language">toArray</span><span class="expression-language">(</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST5">"</span> <span class="ST4">var</span><span class="ST4">=</span><span class="ST5">"t"</span><span class="ST3">></span>
|
|
<span class="ST3"><</span><span class="ST3">h:outputText</span> <span class="ST4">value</span><span class="ST4">=</span><span class="ST5">"key:</span><span class="expression-language">#{</span><span class="expression-language">t</span><span class="expression-language">}</span>
|
|
<span class="ST5">value: </span><span class="expression-language">#{</span><span class="expression-language">map</span><span class="expression-language">.</span><span class="expression-language">get</span><span class="expression-language">(</span><span class="expression-language">t</span><span class="expression-language">)</span><span class="expression-language">}</span><span class="ST5">"</span><span class="ST3">/</span><span class="ST3">></span><span class="ST3"><</span><span class="ST3">br</span><span class="ST3">/></span>
|
|
<span class="ST3"></</span><span class="ST3">ui:repeat</span><span class="ST3">></span>
|
|
<span class="ST3"><</span><span class="ST3">h3</span><span class="ST3">></span> Min of 4<span class="ST3"></</span><span class="ST3">h3</span><span class="ST3">></span>
|
|
<span class="expression-language">#{</span><span class="expression-language">lambdaAction</span><span class="expression-language">.</span><span class="expression-language">lambda2</span><span class="expression-language">(</span><span class="expression-language">min4</span> <span class="expression-language">=</span> <span class="expression-language">(</span><span class="expression-language">w</span><span class="expression-language">,</span> <span class="expression-language">x</span><span class="expression-language">,</span> <span class="expression-language">y</span><span class="expression-language">,</span> <span class="expression-language">z</span><span class="expression-language">)</span> <span class="expression-language">-></span> <span class="expression-language">(</span><span class="expression-language">w</span> <span class="ST8">lt</span> <span class="expression-language">x</span><span class="expression-language">)</span> <span class="expression-language">?</span> <span class="expression-language">(</span><span class="expression-language">(</span><span class="expression-language">w</span> <span class="ST8">lt</span> <span class="expression-language">y</span><span class="expression-language">)</span> <span class="expression-language">?</span> <span class="expression-language">(</span><span class="expression-language">(</span><span class="expression-language">w</span> <span class="ST8">lt</span> <span class="expression-language">z</span><span class="expression-language">)</span> <span class="expression-language">?</span> <span class="expression-language">w</span> <span class="expression-language">:</span> <span class="expression-language">z</span><span class="expression-language">)</span> <span class="expression-language">:</span> <span class="expression-language">(</span><span class="expression-language">(</span><span class="expression-language">y</span> <span class="ST8">lt</span> <span class="expression-language">z</span><span class="expression-language">)</span> <span class="expression-language">?</span> <span class="expression-language">y</span> <span class="expression-language">:</span> <span class="expression-language">z</span><span class="expression-language">)</span><span class="expression-language">)</span> <span class="expression-language">:</span> <span class="expression-language">(</span><span class="expression-language">(</span><span class="expression-language">x</span> <span class="ST8">lt</span> <span class="expression-language">y</span><span class="expression-language">)</span> <span class="expression-language">?</span> <span class="expression-language">(</span><span class="expression-language">(</span><span class="expression-language">x</span> <span class="ST8">lt</span> <span class="expression-language">z</span><span class="expression-language">)</span> <span class="expression-language">?</span> <span class="expression-language">x</span> <span class="expression-language">:</span> <span class="expression-language">z</span><span class="expression-language">)</span> <span class="expression-language">:</span> <span class="expression-language">(</span><span class="expression-language">(</span><span class="expression-language">y</span> <span class="ST8">lt</span> <span class="expression-language">z</span><span class="expression-language">)</span> <span class="expression-language">?</span> <span class="expression-language">y</span> <span class="expression-language">:</span> <span class="expression-language">z</span><span class="expression-language">)</span><span class="expression-language">)</span><span class="expression-language">)</span><span class="expression-language">}</span>;
|
|
|
|
<span class="ST3"></</span><span class="ST3">h:body</span><span class="ST3">></span>
|
|
<span class="ST3"></</span><span class="ST3">html</span><span class="ST3">></span>
|
|
|
|
</pre></body>
|
|
</html>
|