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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package beans;
import classes.Datas;
import classes.Objet;
import classes.SendMail;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
/**
*
* @author FS-ESPRIMO
*/
@ManagedBean
@RequestScoped
public class ContactManagedBean extends Objet {
private String nom="";
private String prenom="";
private String email="";
private String object="";
private String content="";
private String captcha="";
public ContactManagedBean() {
}
public void sendMessage() {
SendMail mail=new SendMail(email, Datas.EMAIL_ADMINSTRATOR);
if(!empty(mail.getErrorMsg())) {
errorMsg+=mail.getErrorMsg();
test=2;
}
mail.setFirstname(prenom);
mail.setLastName(nom);
mail.setObject(object);
mail.setContent(content);
mail.send();
if(empty(mail.getErrorMsg())) {
blank();
test=1;
} else {
errorMsg+=mail.getErrorMsg();
test=2;
}
}
@Override
protected void blank() {
super.blank();
nom="";
prenom="";
email="";
object="";
content="";
captcha="";
}
/**
* @return the nom
*/
public String getNom() {
return nom;
}
/**
* @param nom the nom to set
*/
public void setNom(String nom) {
this.nom = nom;
}
/**
* @return the prenom
*/
public String getPrenom() {
return prenom;
}
/**
* @param prenom the prenom to set
*/
public void setPrenom(String prenom) {
this.prenom = prenom;
}
/**
* @return the object
*/
public String getObject() {
return object;
}
/**
* @param object the object to set
*/
public void setObject(String object) {
this.object = object;
}
/**
* @return the content
*/
public String getContent() {
return content;
}
/**
* @param content the content to set
*/
public void setContent(String content) {
this.content = content;
}
/**
* @return the captcha
*/
public String getCaptcha() {
return captcha;
}
/**
* @param captcha the captcha to set
*/
public void setCaptcha(String captcha) {
this.captcha = captcha;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
} |