bonjour a tous . je suis en cour d developpement d un site web dynamique . j ai connu un probleme dans la vérification des donnés insere par l utilisateur " login et mot de passe " et les vérifier par celles dans la base de donné de ma table personnee. voila le code :
////////
package com.struts.controlleur;
import org.hibernate.*;
import com.ana.Personnee;
import com.util.HibernateUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.struts.data.loginForm;
import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
public final class loginAction extends Action {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
String resultat = null;
String idUser = ((loginForm) form).getIdUser();
String passwordPersonne = ((loginForm) form).getPasswordPersonne();
if (idUser.equals("xyz") && passwordPersonne.equals("xyz")) {
resultat = "succes";
} else {
resultat = "echec";
}
return mapping.findForward(resultat);
}
}
/////
ici la vérification ce fait seulement sur les valeurs login = "xyz" w mt pass="xyz" mais j aime avoir comment verifier les donnés deja dans les collones de ma table.
voila aussi le code de personne.java car j utilise struts :::
///
package com.ana;
// Generated 18 mars 2012 14:55:00 by Hibernate Tools 3.2.0.beta8
/**
* Personnee generated by hbm2java
*/
public class Personnee implements java.io.Serializable {
// Fields
private String nomPersonne;
private String prenomPersonne;
private String villePersonne;
private String paysPersonne;
private String telephonePersonne;
private String emailPersonne;
private String idUser;
private String passwordPersonne;
// Constructors
/** default constructor */
public Personnee() {
}
/** minimal constructor */
public Personnee(String nomPersonne) {
this.nomPersonne = nomPersonne;
}
/** full constructor */
public Personnee(String nomPersonne, String prenomPersonne,
String villePersonne, String paysPersonne,
String telephonePersonne, String emailPersonne, String idUser,
String passwordPersonne) {
this.nomPersonne = nomPersonne;
this.prenomPersonne = prenomPersonne;
this.villePersonne = villePersonne;
this.paysPersonne = paysPersonne;
this.telephonePersonne = telephonePersonne;
this.emailPersonne = emailPersonne;
this.idUser = idUser;
this.passwordPersonne = passwordPersonne;
}
// Property accessors
public String getNomPersonne() {
return this.nomPersonne;
}
public void setNomPersonne(String nomPersonne) {
this.nomPersonne = nomPersonne;
}
public String getPrenomPersonne() {
return this.prenomPersonne;
}
public void setPrenomPersonne(String prenomPersonne) {
this.prenomPersonne = prenomPersonne;
}
public String getVillePersonne() {
return this.villePersonne;
}
public void setVillePersonne(String villePersonne) {
this.villePersonne = villePersonne;
}
public String getPaysPersonne() {
return this.paysPersonne;
}
public void setPaysPersonne(String paysPersonne) {
this.paysPersonne = paysPersonne;
}
public String getTelephonePersonne() {
return this.telephonePersonne;
}
public void setTelephonePersonne(String telephonePersonne) {
this.telephonePersonne = telephonePersonne;
}
public String getEmailPersonne() {
return this.emailPersonne;
}
public void setEmailPersonne(String emailPersonne) {
this.emailPersonne = emailPersonne;
}
public String getIdUser() {
return this.idUser;
}
public void setIdUser(String idUser) {
this.idUser = idUser;
}
public String getPasswordPersonne() {
return this.passwordPersonne;
}
public void setPasswordPersonne(String passwordPersonne) {
this.passwordPersonne = passwordPersonne;
}
}
///////////
/////
et voila le code de loginform
///////
package com.struts.data;
import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;
public class loginForm extends ActionForm {
/**
*
*/
private static final long serialVersionUID = 1L;
private String idUser;
private String passwordPersonne;
public String getIdUser() {
return this.idUser;
}
public void setIdUser(String idUser) {
this.idUser = idUser;
}
public String getPasswordPersonne() {
return this.passwordPersonne;
}
public void setPasswordPersonne(String passwordPersonne) {
this.passwordPersonne = passwordPersonne;
}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
return errors;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.idUser = null;
this.passwordPersonne = null;
}
}/////
et merci d avance :)
et merci
Afficher la suite