Caleb Fontenot
778965c800
modified: .gitignore new file: Semester 2/LabJuneauValidateUserInput/Printed HTMLs/Company.html new file: Semester 2/LabJuneauValidateUserInput/Printed HTMLs/Employee.html new file: Semester 2/LabJuneauValidateUserInput/Printed HTMLs/EmployeeController.html new file: Semester 2/LabJuneauValidateUserInput/Printed HTMLs/EmployeeInterface.html new file: Semester 2/LabJuneauValidateUserInput/Printed HTMLs/EmployeeTitleValidate.html new file: Semester 2/LabJuneauValidateUserInput/Printed HTMLs/index.html new file: Semester 2/LabJuneauValidateUserInput/nb-configuration.xml new file: Semester 2/LabJuneauValidateUserInput/pom.xml new file: Semester 2/LabJuneauValidateUserInput/src/main/java/com/pap/exam/labjuneauvalidateuserinput/JakartaRestConfiguration.java new file: Semester 2/LabJuneauValidateUserInput/src/main/java/com/pap/exam/labjuneauvalidateuserinput/resources/JakartaEE9Resource.java new file: Semester 2/LabJuneauValidateUserInput/src/main/java/edu/slcc/asdv/beans/EmployeeController.java new file: Semester 2/LabJuneauValidateUserInput/src/main/java/edu/slcc/asdv/bl/Company.java new file: Semester 2/LabJuneauValidateUserInput/src/main/java/edu/slcc/asdv/bl/Employee.java new file: Semester 2/LabJuneauValidateUserInput/src/main/java/edu/slcc/asdv/bl/EmployeeInterface.java new file: Semester 2/LabJuneauValidateUserInput/src/main/java/edu/slcc/asdv/validators/EmployeeTitleValidate.java new file: Semester 2/LabJuneauValidateUserInput/src/main/resources/META-INF/persistence.xml new file: Semester 2/LabJuneauValidateUserInput/src/main/webapp/WEB-INF/beans.xml new file: Semester 2/LabJuneauValidateUserInput/src/main/webapp/WEB-INF/glassfish-web.xml new file: Semester 2/LabJuneauValidateUserInput/src/main/webapp/WEB-INF/web.xml new file: Semester 2/LabJuneauValidateUserInput/src/main/webapp/index.xhtml new file: Semester 2/LabJuneauValidateUserInput/src/main/webapp/resources/css/1.css new file: Semester 2/LabJuneauValidateUserInput/src/main/webapp/resources/images/1.png modified: Semester 2/LabJuneauValidateUserInput_CalebFontenot/src/main/java/bl/Company.java deleted: Semester 2/ZIPs/LabJuneauValidateUserInput_CalebFontenot.zip
59 lines
2.9 KiB
HTML
59 lines
2.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<title>EmployeeTitleValidate.java</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}
|
|
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
|
table {color: #888888; background-color: #313335; font-family: monospace}
|
|
.string {color: #6a8759}
|
|
.whitespace {color: #505050}
|
|
.literal {color: #cc7832}
|
|
-->
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<table width="100%"><tr><td align="center">/home/caleb/ASDV-WebDev/Semester 2/LabJuneauValidateUserInput/src/main/java/edu/slcc/asdv/validators/EmployeeTitleValidate.java</td></tr></table>
|
|
<pre>
|
|
<span class="literal">package</span> edu.slcc.asdv.validators;
|
|
|
|
<span class="literal">import</span> jakarta.faces.application.FacesMessage;
|
|
<span class="literal">import</span> jakarta.faces.component.UIComponent;
|
|
<span class="literal">import</span> jakarta.faces.context.FacesContext;
|
|
<span class="literal">import</span> jakarta.faces.validator.FacesValidator;
|
|
<span class="literal">import</span> jakarta.faces.validator.Validator;
|
|
<span class="literal">import</span> jakarta.faces.validator.ValidatorException;
|
|
|
|
@FacesValidator(<span class="string">"</span><span class="string">employeeTitleValidate</span><span class="string">"</span>)
|
|
<span class="literal">public</span> <span class="literal">class</span> EmployeeTitleValidate <span class="literal">implements</span> Validator
|
|
{
|
|
|
|
@Override
|
|
<span class="literal">public</span> <span class="literal">void</span> validate(FacesContext fc, UIComponent uic, Object t)
|
|
<span class="literal">throws</span> ValidatorException
|
|
{
|
|
checkTitle(t);
|
|
}
|
|
|
|
<span class="literal">private</span> <span class="literal">void</span> checkTitle(Object value)
|
|
{
|
|
String title = value.toString();
|
|
title = title.toLowerCase();
|
|
<span class="literal">if</span> (!title.contains(<span class="string">"</span><span class="string">java</span><span class="string">"</span>))
|
|
{
|
|
String messageText = <span class="string">"</span><span class="string">Title does not include the word Java</span><span class="string">"</span>;
|
|
String messageTextLong = <span class="string">"</span><span class="string">Title does not include the word Java. </span><span class="string">"</span>
|
|
+ <span class="string">"</span><span class="string">Please type java</span><span class="string">"</span>;
|
|
<span class="literal">throw</span> <span class="literal">new</span> ValidatorException(
|
|
<span class="literal">new</span> FacesMessage(FacesMessage.SEVERITY_ERROR,
|
|
messageText, messageTextLong));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
</pre></body>
|
|
</html>
|