1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
| /*
* EmployeForm.java
*
* Created on 6 mars 2007, 15:30
*/
package com.myapp.struts;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/* classes applicatives access oracle
import java.sql.*;
import java.io.*;
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import composant.pool.*;
import composant.syslog.*;*/
/**
*
* @author gregory
* @version
*/
public class EmployeForm extends org.apache.struts.action.ActionForm {
private String cle = null;
private String code = null;
private String nom = null;
private String prenom = null;
private String qualification = null;
public String getCle() {
return cle;
}
public void setCle(String Cle) {
cle = Cle;
}
public String getCode() {
return code;
}
public void setCode(String cod) {
code = cod;
}
public String getNom() {
return nom;
}
public void setNom(String no) {
nom = no;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String pren) {
prenom = pren;
}
public String getQualification() {
return qualification;
}
public void setQualification(String Qualification) {
qualification = Qualification;
}
/**
*
*/
public EmployeForm() {
super();
// TODO Auto-generated constructor stub
}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (getNom() == null || getNom().length() < 1){
errors.add("nomVide", new ActionMessage("erreur.creeEmp.nom.requis"));
// TODO: add 'error.name.required' key to your resources
}
if (getPrenom() == null || getPrenom().length() < 1) {
errors.add("prenomVide", new ActionMessage("erreur.creeEmp.prenom.requis"));
}
return errors;
}
} |
Partager