IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Struts 1 Java Discussion :

récupération des données d'une table dans une page jsp


Sujet :

Struts 1 Java

  1. #1
    Membre à l'essai
    Inscrit en
    Février 2008
    Messages
    42
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 42
    Points : 22
    Points
    22
    Par défaut récupération des données d'une table dans une page jsp
    Bonjour ,

    je travaille sur une application en utilisant struts,
    ce que je veux faire c'est

    1- récupérer des données de ma table pour les mettre dans une liste déroulante dans un formulaire (fiche.jsp)

    2- puis choisir de cette liste une entité et remplir les autres champs pour ajouter une fiche dans la table fiche.

    voici le code de ma page.

    fiche.jsp

    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
    <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

    <html:form action="gfiche.do">
    Sujet: <html:text property="sujet" value=""></html:text>
    Auteur: <html:text property="auteur" value=""></html:text>
    E-mail: <html:text property="mail" value=""></html:text>
    Groupe : <html:select property="groupe">
    <html:option value="ESF">ESF </html:option>
    <html:option value="ECD">ECD</html:option>
    <html:option value="ECE">ECE</html:option>
    </html:select>
    Langue: <html:text property="langue" value=""></html:text>
    Réference Externe: <html:text property="reference_externe" value=""></html:text>
    Description: <html:textarea property="description" value=""></html:textarea>
    Corps: <html:textarea property="corps" value=""></html:textarea>
    Mot cle: <html:text property="mot_cle" value=""></html:text>
    Etat: <html:select property="etat">
    <html:option value="Sauvee">Sauvée </html:option>
    <html:option value="En cours">En cours</html:option>
    <html:option value="Validee">Validée</html:option>
    </html:select>
    Commentaires:
    <html:textarea property="commentaires" value=""></html:textarea>
    Opinion: <html:select property="opinion">
    <html:option value="Satisfaisante">Satisfaisante</html:option>
    <html:option value="Moyenne">Moyenne</html:option>
    <html:option value="Faible">Faible</html:option>
    </html:select>

    <html:select property="idprojet">
    <html:optionsCollection property="Listprojet" value="idprojet" label="Libelle_projet"/>
    </html:select>
    <html:select property="idcategorie">
    <html:optionsCollection property="Listcategorie" value="idcategorie" label="titre"/>
    </html:select>
    <html:select property="iddocument">
    <html:optionsCollection property="Listdocument" value="iddocument" label="Libelle_categorie"/>
    </html:select>



    <html:submit value="Ajouter" property="action"></html:submit>
    </html:form>
    <html:errors/>

    Ficheform (mon bean)

    /* Date datesys = new java.sql.Date(System.currentTimeMillis()); */

    package presentation;

    import java.sql.Date;
    import java.util.List;
    import java.util.Vector;

    import javax.servlet.http.HttpServletRequest;

    import metier.GC_Categorie;
    import metier.GC_Document;
    import metier.GC_Projet;
    import metier.*;

    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;

    public class FicheForm extends ActionForm{


    private String sujet;
    private String description;
    private String corps;
    private String langue;
    private String groupe;
    private String reference_externe;
    private String auteur ;
    private String mail ;
    private String mot_cle;
    private Date date_modification;
    private Date date_creation ;
    private String etat ;
    private String commentaires ;
    private String opinion;
    private long idprojet;
    private long idcategorie;
    private long iddocument;
    List<GC_Document> Listdocument = new Vector<GC_Document>();
    List<GC_Projet> Listprojet = new Vector<GC_Projet>();
    List<GC_Categorie> Listcategorie= new Vector<GC_Categorie>();

    private String action="";
    //private List documents = new Vector<Fiche>();



    /* Getters and Setters */

    public String getSujet() {
    return sujet;
    }
    public void setSujet(String sujet) {
    this.sujet = sujet;
    }
    public String getDescription() {
    return description;
    }
    public void setDescription(String description) {
    this.description = description;
    }
    public String getCorps() {
    return corps;
    }
    public void setCorps(String corps) {
    this.corps = corps;
    }
    public String getLangue() {
    return langue;
    }
    public void setLangue(String langue) {
    this.langue = langue;
    }
    public String getGroupe() {
    return groupe;
    }
    public void setGroupe(String groupe) {
    this.groupe = groupe;
    }
    public String getReference_externe() {
    return reference_externe;
    }
    public void setReference_externe(String reference_externe) {
    this.reference_externe = reference_externe;
    }
    public String getAuteur() {
    return auteur;
    }
    public void setAuteur(String auteur) {
    this.auteur = auteur;
    }
    public String getMail() {
    return mail;
    }
    public void setMail(String mail) {
    this.mail = mail;
    }
    public String getMot_cle() {
    return mot_cle;
    }
    public void setMot_cle(String mot_cle) {
    this.mot_cle = mot_cle;
    }
    public Date getDate_modification() {
    return date_modification;
    }
    public void setDate_modification(Date date_modification) {
    this.date_modification = date_modification;
    }
    public Date getDate_creation() {
    return date_creation;
    }
    public void setDate_creation(Date date_creation) {
    this.date_creation = date_creation;
    }
    public String getEtat() {
    return etat;
    }
    public void setEtat(String etat) {
    this.etat = etat;
    }
    public String getCommentaires() {
    return commentaires;
    }
    public void setCommentaires(String commentaires) {
    this.commentaires = commentaires;
    }
    public String getOpinion() {
    return opinion;
    }
    public void setOpinion(String opinion) {
    this.opinion = opinion;
    }
    public long getIdprojet() {
    return idprojet;
    }
    public void setIdprojet(long idprojet) {
    this.idprojet = idprojet;
    }
    public long getIdcategorie() {
    return idcategorie;
    }
    public void setIdcategorie(long idcategorie) {
    this.idcategorie = idcategorie;
    }
    public long getIddocument() {
    return iddocument;
    }
    public void setIddocument(long iddocument) {
    this.iddocument = iddocument;
    }
    public String getAction() {
    return action;
    }
    public void setAction(String action) {
    this.action = action;
    }

    public List getListdocument() {
    return Listdocument;
    }
    public void setListdocument(List listdocument) {
    Listdocument = listdocument;
    }
    public List getListprojet() {
    return Listprojet;
    }
    public void setListprojet(List listprojet) {
    Listprojet = listprojet;
    }
    public List getListcategorie() {
    return Listcategorie;
    }
    public void setListcategorie(List listcategorie) {
    Listcategorie = listcategorie;
    }

    @Override
    public ActionErrors validate(ActionMapping mapping,
    HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();//collection qui contient les erreurs
    if(sujet.length()==0){
    errors.add("sujetnull", new ActionError("error.sujet.vide"));

    }
    return errors;
    }
    @Override
    public void reset(ActionMapping mapping, HttpServletRequest request) {
    this.sujet="";
    }


    }
    FicheAction

    package presentation;

    import java.sql.Date;
    import java.util.List;

    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import presentation.FicheForm;
    import metier.*;
    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 org.apache.struts.action.ActionMessage;
    import org.apache.struts.action.ActionMessages;

    public class FicheAction extends Action{



    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {

    FicheForm fform=(FicheForm)form;
    Operation o = new Operation();


    ActionMessages errors = form.validate(mapping,request);
    if ( !errors.isEmpty() )
    {
    this.saveErrors(request,errors);
    }else {

    fform.setListcategorie(o.getToutcategorie());
    fform.setListdocument(o.getToutdocument()) ;
    fform.setListprojet(o.getToutprojet());

    System.out.println(fform.getListprojet().size());

    o.addFiche(fform.getSujet(), fform.getDescription(),
    fform.getCorps(),fform.getLangue(), fform.getGroupe(),
    fform.getReference_externe(),fform.getAuteur(),fform.getMail(),
    fform.getMot_cle(),fform.getDate_modification(), fform.getDate_creation(),
    fform.getEtat(),fform.getCommentaires(), fform.getOpinion(),
    fform.getIdprojet(), fform.getIddocument(),fform.getIdcategorie());
    }



    return mapping.findForward("VueFiche");
    }
    }

    voici l'erreur qu'il me donne


    GRAVE: "Servlet.service()" pour la servlet jsp a lancé une exception
    javax.servlet.jsp.JspException: No getter method for property Listprojet of bean org.apache.struts.taglib.html.BEAN
    at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:973)

  2. #2
    Membre actif Avatar de Tanebisse
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2007
    Messages
    449
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2007
    Messages : 449
    Points : 260
    Points
    260
    Par défaut
    Met une minuscule à ta propriété Listprojet dans ton form, les propriété doivent tjrs commencer par une minuscule dans les bean. J'écrirai plutôt :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    private List<GC_Projet> listProjet;
    
    public List getListProjet() {
         return this.listProjet;
    }
    public void setListProjet(List listProjet) {
         this.listProjet = listProjet;
    }
    En faisant bien gaf aux minuscules et majuscules.

  3. #3
    Membre à l'essai
    Inscrit en
    Février 2008
    Messages
    42
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 42
    Points : 22
    Points
    22
    Par défaut
    merci bcp ca marche , la page jsp s'affiche mais j'ai un petit souci c'est qu'il ne récupére pas de donnée les listes sont vides.

    que vais je faire ?

  4. #4
    Membre actif Avatar de Tanebisse
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2007
    Messages
    449
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2007
    Messages : 449
    Points : 260
    Points
    260
    Par défaut
    Quand tu fais ça dans ta classe action :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    fform.setListprojet(o.getToutprojet());
     
    System.out.println(fform.getListprojet().size());
    T'as bien une taille pour ta liste ? Sinon va plutot voir du coté de o.getToutProjet.

  5. #5
    Membre à l'essai
    Inscrit en
    Février 2008
    Messages
    42
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 42
    Points : 22
    Points
    22
    Par défaut
    j'ai fait des tests sur mon metier avec une classe main et ca marche il m'affiche la taille de ma liste et les élément de la liste.

    voici ma fonction

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    // la liste des projets 
     
    	public List getToutprojet(){
    		 Session   session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
    		 return session.createQuery("from GC_Projet").list();
    	}

  6. #6
    Membre actif Avatar de Tanebisse
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2007
    Messages
    449
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2007
    Messages : 449
    Points : 260
    Points
    260
    Par défaut
    Bon alors c'est dans ta JSP
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    <html:select property="idprojet">
    <html:optionsCollection property="Listprojet" value="idprojet" label="Libelle_projet"/>
    </html:select>
    Voici le code que j'ai dans un de mes projets :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    <html:select name="tonForm" property="unePropieteDunObjetDeLaListe" >
    	<html:options collection="taCollection" property="unePropieteDunObjetDeLaListe" labelProperty="unePropieteDunObjetDeLaListe"/>
    </html:select>
    Dans le select indique bien le "name" de ton Form, celui que tu as déclaré dans ton Struts-config.xml dans formBean.

    Ça ça devrait le faire.

  7. #7
    Membre à l'essai
    Inscrit en
    Février 2008
    Messages
    42
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 42
    Points : 22
    Points
    22
    Par défaut
    j'ai essayé mais ca marche pas ,

    la propriete de ma liste correspond à un attribut dans ma classe GC_Projet n'est ce pas ?

    puisque maliste de projet a des éléments de type GC_Projet ?

  8. #8
    Débutant
    Inscrit en
    Septembre 2007
    Messages
    372
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 372
    Points : 86
    Points
    86
    Par défaut
    Bonjour, on peut voir ton struts config, et le morceau qui correspond a ta liste de categorie dans ta page jsp ?

  9. #9
    Membre à l'essai
    Inscrit en
    Février 2008
    Messages
    42
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 42
    Points : 22
    Points
    22
    Par défaut
    Citation Envoyé par newmar Voir le message
    Bonjour, on peut voir ton struts config, et le morceau qui correspond a ta liste de categorie dans ta page jsp ?
    Struts config
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
     
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
              "http://struts.apache.org/dtds/struts-config_1_2.dtd">
     
    <struts-config>
     
      <form-beans>
     	<form-bean name="gc" type="presentation.FicheForm"/>
      </form-beans>
     
       <global-forwards>
       <forward name="VueFiche"  path="fiche.template" />
      </global-forwards>
     
     <action-mappings>
     
    	 <action 
    	 path="/gfiche" 
    	 name="gc" 
    	 type="presentation.FicheAction" 
    	 scope="session"
    	 validate="false">	 
    	</action>	
    	 </action-mappings>
     
     <message-resources parameter="ApplicationResources"/>  
     
      <!-- Tiles Configuration -->
    <plug-in className="org.apache.struts.tiles.TilesPlugin">
      <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>
    </plug-in>
     
     </struts-config>
    le morceau de code pour la liste des categorie et des document

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     Projet :  <html:select name="gc" property="idProjet" >
    	<html:options collection="listProjet" property="idProjet" labelProperty="libelle_projet"/>
    </html:select>
     
     
         Categorie :  <html:select name="gc" property="idCategorie" >
    	<html:options collection="listCategorie" property="idCategorie" labelProperty="libelle_categorie"/>
    </html:select>
     
        Document :  <html:select name="gc" property="idDocument" >
    	<html:options collection="listDocument" property="idDocument" labelProperty="titre"/>
    </html:select>

  10. #10
    Débutant
    Inscrit en
    Septembre 2007
    Messages
    372
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 372
    Points : 86
    Points
    86
    Par défaut
    normalement comme t'a dis tanbisse, t'a changé tes attribut en mettant des attributs avec des miniscules donc si tu déclare :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    private List<GC_Categorie> istcategorie= new Vector<GC_Categorie>();
    tu va mettre :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <html:select property="idCategorie">
       <html:optionsCollection name="gc" property="listCategorie" value="idCategorie" label="libelle_categorie"/>
       </html:select>
    et tu dois avoir idCategorie et non pas idcategorie dans ton form(la valeur sélectionné ca doit etre du meme type que idCategorie dans ton GC_Categorie.java ),
    avec idCategorie, libelle_categorie comme des attribut dans ta GC_Categorie.java,

    tu dois respecté la facon dont tu renomme idCategorie est different de idcategorie !

  11. #11
    Membre à l'essai
    Inscrit en
    Février 2008
    Messages
    42
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 42
    Points : 22
    Points
    22
    Par défaut
    cela veut dire que je dois donner des noms des variables dans mon form qui s'ecrivent de la meme facon que celle dans ma classe GC_Categorie:

    dans GC_Categorie j'ai : idCategorie

    dans mon form j'aurai : idCategorie

    et dans ma pages JSP : idCategorie comme property



    dans mon form
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    private long idCategorie;
    private List<GC_Categorie> listCategorie= new Vector<GC_Categorie>();
    dans ma classe GC_Categorie

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    private long idCategorie;
    private String libelle_categorie;
    dans ma jsp

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
      Categorie :  <html:select name="gc" property="idCategorie" >
    	<html:options collection="listCategorie" property="idCategorie" labelProperty="libelle_categorie"/>
    </html:select>

  12. #12
    Débutant
    Inscrit en
    Septembre 2007
    Messages
    372
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 372
    Points : 86
    Points
    86
    Par défaut
    cela veut dire que je dois donner des noms des variables dans mon form qui s'ecrivent de la meme facon que celle dans ma classe GC_Categorie
    c'est pas nécéssaire, la valeur dans ton form tu peux l'appeler n'importe comment, c'est la valeur que tu va sélectionné dans ta liste déroulante par exemple : private long selectedCategorie, avec des getters et setters

    alors que dans ta jsp :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Categorie :  <html:select name="gc" property="selectedCategorie" >
    	<html:options collection="listCategorie" property="idCategorie" labelProperty="libelle_categorie"/>
    </html:select>
    mais : idCategorie, libelle_categorie ca doit correspondre a ton GC_Categorie.java

    Siham concentre un tout petit peu ,

    mais liste ca dois etre :

    private List<GC_Categorie> listCategorie= new Vector<GC_Categorie>();

    Dans dans ta jsp : tu met : listCategorie et pas ListCategorie

    dans ton form : listCategorie doit avoir des getters et des setters

    dans ton actions :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    fform.setListprojet(o.getToutprojet());
    et dans ton metier :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    	public List getToutprojet(){
    		 Session   session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
    		 return session.createQuery("from GC_Categorie").list();
    	}
    ,

    ca doit marcher

  13. #13
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    listCategorie étant une propriété de l'ActionForm, la bonne écriture est celle-ci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <html:select property="idCategorie">
       <html:optionsCollection property="listCategorie" value="idCategorie" label="libelle_categorie"/>
    </html:select>
    Le html:select étant obligatoirement dans un html:form, il n'est pas utile de mettre un attribut name car celui-ci a pour valeur par défaut le nom du form-bean défini dans le mapping de l'Action.
    Modératrice Java - Struts, Servlets/JSP, ...

  14. #14
    Membre actif Avatar de Tanebisse
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2007
    Messages
    449
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2007
    Messages : 449
    Points : 260
    Points
    260
    Par défaut
    Merci bien pour ces précisions c_nvy c'est tjs utile.
    T'es la reine

  15. #15
    Membre à l'essai
    Inscrit en
    Février 2008
    Messages
    42
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 42
    Points : 22
    Points
    22
    Par défaut
    Bonjour

    j'ai suivi exactement les étapes que vous m'avez décrit , je vous remercie pour votre aide mais la page ne récupére tjrs pas de données de ma table et dans le ficher log du serveur tomcat j'ai pas d'erreur .
    pour la table j'ai des enregistrements dans celle ci donc il n'y a tjrs de raison que ca marche pas.

    je ne sais pas quoi faire

  16. #16
    Débutant
    Inscrit en
    Septembre 2007
    Messages
    372
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 372
    Points : 86
    Points
    86
    Par défaut
    essai de poster ton form, ta jsp, ton action, et ta classe aussi

  17. #17
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    L'Action dans laquelle tu as codé ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    fform.setListcategorie(o.getToutcategorie());
    est bien exécutée avant l'affichage de la jsp ?
    Modératrice Java - Struts, Servlets/JSP, ...

  18. #18
    Membre actif Avatar de Tanebisse
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2007
    Messages
    449
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2007
    Messages : 449
    Points : 260
    Points
    260
    Par défaut
    Dans ce cas essai juste pour voir dans ton action de faire :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    request.setAttribute("listCat", listCategorie);
    Puis dans ta JSP
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    <logic:iterate id="element" name="listCat">
    	<bean:write name="element" property="libelle_categorie"/>
    </logic:iterate>
    Si ça ça marche pas c'est que la vérité est ailleurs.
    Ça ne resoudra pas ton problème c'est juste pour voir. Fais le test.

  19. #19
    Membre à l'essai
    Inscrit en
    Février 2008
    Messages
    42
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 42
    Points : 22
    Points
    22
    Par défaut
    FicheForm.java

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
     
    /* Date datesys = new java.sql.Date(System.currentTimeMillis()); */
     
    package presentation;
     
    import java.sql.Date;
    import java.util.List;
    import java.util.Vector;
     
    import javax.servlet.http.HttpServletRequest;
     
    import metier.GC_Categorie;
    import metier.GC_Document;
    import metier.GC_Projet;
    import metier.*;
     
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
     
    public class FicheForm  extends ActionForm{
     
     
    	private String sujet;
    	private String description;
    	private String corps;
    	private String langue;
    	private String groupe;
    	private String reference_externe;
    	private String auteur ;
    	private String mail ;
    	private String mot_cle;
    	private Date date_modification; 
    	private Date date_creation ;
    	private String etat ;
    	private String commentaires ; 
    	private String opinion;
    	private long idprojetselected;
    	private long idcategorieselected;
    	private long iddocumentselected;
    	private List<GC_Document> listDocument = new Vector<GC_Document>();
    	private List<GC_Projet> listProjet=new Vector<GC_Projet>();
    	private List<GC_Categorie> listCategorie= new Vector<GC_Categorie>();
    	private List<GC_Fiche> listFiche= new Vector<GC_Fiche>();
    	private String action="";
     
    	//private List documents = new Vector<Fiche>();
     
    	/* Getters and Setters */
     
    	public String getSujet() {
    		return sujet;
    	}
    	public void setSujet(String sujet) {
    		this.sujet = sujet;
    	}
    	public String getDescription() {
    		return description;
    	}
    	public void setDescription(String description) {
    		this.description = description;
    	}
    	public String getCorps() {
    		return corps;
    	}
    	public void setCorps(String corps) {
    		this.corps = corps;
    	}
    	public String getLangue() {
    		return langue;
    	}
    	public void setLangue(String langue) {
    		this.langue = langue;
    	}
    	public String getGroupe() {
    		return groupe;
    	}
    	public void setGroupe(String groupe) {
    		this.groupe = groupe;
    	}
    	public String getReference_externe() {
    		return reference_externe;
    	}
    	public void setReference_externe(String reference_externe) {
    		this.reference_externe = reference_externe;
    	}
    	public String getAuteur() {
    		return auteur;
    	}
    	public void setAuteur(String auteur) {
    		this.auteur = auteur;
    	}
    	public String getMail() {
    		return mail;
    	}
    	public void setMail(String mail) {
    		this.mail = mail;
    	}
    	public String getMot_cle() {
    		return mot_cle;
    	}
    	public void setMot_cle(String mot_cle) {
    		this.mot_cle = mot_cle;
    	}
    	public Date getDate_modification() {
    		return date_modification;
    	}
    	public void setDate_modification(Date date_modification) {
    		this.date_modification = date_modification;
    	}
    	public Date getDate_creation() {
    		return date_creation;
    	}
    	public void setDate_creation(Date date_creation) {
    		this.date_creation = date_creation;
    	}
    	public String getEtat() {
    		return etat;
    	}
    	public void setEtat(String etat) {
    		this.etat = etat;
    	}
    	public String getCommentaires() {
    		return commentaires;
    	}
    	public void setCommentaires(String commentaires) {
    		this.commentaires = commentaires;
    	}
    	public String getOpinion() {
    		return opinion;
    	}
    	public void setOpinion(String opinion) {
    		this.opinion = opinion;
    	}
    	public String getAction() {
    		return action;
    	}
    	public void setAction(String action) {
    		this.action = action;
    	}
     
    	public List<GC_Document> getListDocument() {
    		return listDocument;
    	}
    	public void setListDocument(List<GC_Document> listDocument) {
    		this.listDocument = listDocument;
    	}
    	public List<GC_Projet> getListProjet() {
    		return listProjet;
    	}
    	public void setListProjet(List<GC_Projet> listProjet) {
    		this.listProjet = listProjet;
    	}
    	public List<GC_Categorie> getListCategorie() {
    		return listCategorie;
    	}
    	public void setListCategorie(List<GC_Categorie> listCategorie) {
    		this.listCategorie = listCategorie;
    	}
    	public long getIdprojetselected() 
    	{
    		return idprojetselected;
    	}
    	public void setIdprojetselected(long idprojetselected)
    	{
    		this.idprojetselected = idprojetselected;
    	}
    	public long getIdcategorieselected() {
    		return idcategorieselected;
    	}
    	public void setIdcategorieselected(long idcategorieselected) {
    		this.idcategorieselected = idcategorieselected;
    	}
    	public long getIddocumentselected() {
    		return iddocumentselected;
    	}
    	public void setIddocumentselected(long iddocumentselected) {
    		this.iddocumentselected = iddocumentselected;
    	}
    	public List<GC_Fiche> getListFiche() {
    		return listFiche;
    	}
    	public void setListFiche(List<GC_Fiche> listFiche) {
    		this.listFiche = listFiche;
    	}
    	@Override
    	public ActionErrors validate(ActionMapping mapping,
    			HttpServletRequest request) {		
    		ActionErrors errors = new ActionErrors();//collection qui contient les erreurs
    		if(sujet.length()==0){
    			errors.add("sujetnull", new ActionError("error.sujet.vide"));
     
    		}
    		return errors;
    	}
    	@Override
    	public void reset(ActionMapping mapping, HttpServletRequest request) 
    	{
    			this.sujet="";
    	}
     
     
     
    }
    FicheAction
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    package presentation;
     
    import java.sql.Date;
    import java.util.List;
    import java.util.Vector;
     
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
     
    import presentation.FicheForm;
    import metier.*;
     
    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 org.apache.struts.action.ActionMessage;
    import org.apache.struts.action.ActionMessages;
     
    public class FicheAction extends Action{
     
    	public ActionForward execute(ActionMapping mapping, ActionForm form,
    			HttpServletRequest request, HttpServletResponse response)
    			throws Exception {
     
            FicheForm fform=(FicheForm)form;
    		Operation o = new Operation();
     
     
    		ActionMessages errors = form.validate(mapping,request);
    		if ( !errors.isEmpty() )
    		{
    			this.saveErrors(request,errors);
    		}else {
     
    			fform.setListCategorie(o.getToutcategorie());
    			fform.setListDocument(o.getToutdocument()) ;
    			fform.setListProjet(o.getToutprojet());	
    			//System.out.println(fform.getListProjet().size());
     
    			o.addFiche(fform.getSujet(), fform.getDescription(), 
    					fform.getCorps(),fform.getLangue(), fform.getGroupe(),
    					fform.getReference_externe(),fform.getAuteur(),fform.getMail(), 
    					fform.getMot_cle(),fform.getDate_modification(),fform.getDate_creation(),
    					fform.getEtat(),fform.getCommentaires(), fform.getOpinion(),
    					fform.getIdprojetselected(), fform.getIddocumentselected(),fform.getIdcategorieselected());
     
    		}
     
     
    		return mapping.findForward("VueFiche");
    	}
    }
    fiche.jsp

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
    <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
     
    <html:form action="gfiche.do">
    Sujet: <html:text property="sujet" value=""></html:text>
    Auteur: <html:text property="auteur" value=""></html:text>
    E-mail: <html:text property="mail" value=""></html:text>
    Groupe : <html:select property="groupe">
             <html:option value="ESF">ESF </html:option>
             <html:option value="ECD">ECD</html:option>
             <html:option value="ECE">ECE</html:option>
             </html:select>
     Langue: <html:text property="langue" value=""></html:text> 
     Réference Externe: <html:text property="reference_externe" value=""></html:text>       
    Description: <html:textarea property="description" value=""></html:textarea>
    Corps: <html:textarea property="corps" value=""></html:textarea>
    Mot cle: <html:text property="mot_cle" value=""></html:text>
    Etat: <html:select property="etat">
             <html:option value="Sauvee">Sauvée </html:option>
             <html:option value="En cours">En cours</html:option>
             <html:option value="Validee">Validée</html:option>
             </html:select>
    Commentaires: 
        <html:textarea property="commentaires" value=""></html:textarea>
    Opinion: <html:select property="opinion">
             <html:option value="Satisfaisante">Satisfaisante</html:option>
             <html:option value="Moyenne">Moyenne</html:option>
             <html:option value="Faible">Faible</html:option>
             </html:select>
     
         Projet :<html:select property="idprojetselected">
       <html:optionsCollection property="listProjet" value="idProjet" label="libelle_projet"/>
    </html:select>
    Categorie :<html:select property="idcategorieselected">
       <html:optionsCollection property="listCategorie" value="idCategorie" label="libelle_categorie"/>
    </html:select>
    Document :<html:select property="iddocumentselected">
       <html:optionsCollection property="listDocument" value="idDocument" label="titre"/>
    </html:select>
     
    <html:submit value="Ajouter" property="action"></html:submit>
    </html:form>
    <html:errors/>
    operation.java

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    package metier;
     
    import java.sql.Date;
    import java.util.List;
     
    import org.hibernate.Session;
     
    import util.HibernateUtil;
     
    public class Operation {
     
    	// Ajout d'une fiche 
     
    	public void addFiche( String sujet, String description,
    			String corps, String langue, String groupe,
    			String reference_externe, String auteur, String mail,
    			String mot_cle, Date date_modification, Date date_creation,
    			String etat, String commentaires, String opinion, long idprojet,long 
    			iddocument, long idcategorie){
     
    		 Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
     
    		 GC_Fiche f =new GC_Fiche(sujet,description,corps,langue,groupe,reference_externe, auteur,mail
    				 ,mot_cle,date_modification,date_creation,etat,commentaires,opinion);
    		 GC_Projet pj = ( GC_Projet) session.load(GC_Projet.class, idprojet);
    		 GC_Categorie cat =(GC_Categorie) session.load(GC_Categorie.class,idcategorie);
    		 GC_Document doc =(GC_Document)session.load(GC_Document.class,iddocument);
    		 pj.addFiche(f);
    		 cat.addFiche(f);
    		 doc.addFiche(f);
    		 f.setCategorie(cat);
    		 f.setDocument(doc);
    		 f.setProjet(pj);
    		 session.save(f);
    		 session.getTransaction().commit();
    	}
     
    	// Ajout d'un projet 
    	public void addProjet(String libelle_projet){
     
    		 Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
     
    		 GC_Projet p = new GC_Projet();
    		 p.setLibelle_projet(libelle_projet);
     
    		 session.save(p);
    		 session.getTransaction().commit();
    	}
     
    	// Ajout d'une categorie 
     
    	public void addCategorie(String libelle_Categorie){
     
    		 Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
     
    		 GC_Categorie cat = new GC_Categorie();
    		 cat.setLibelle_categorie(libelle_Categorie);
     
    		 session.save(cat);
    		 session.getTransaction().commit();
    	}
     
    	// Ajout d'un document 
     
    	public void addDocument(String titre, String description_doc, String langue,
    			String emplacement, String type_doc, String ss_type){
     
    		 Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
     
    		 GC_Document doc = new  GC_Document(titre,description_doc, langue,
    				 emplacement, type_doc, ss_type);
     
     
    		 session.save(doc);
    		 session.getTransaction().commit();
    	}
     
     
    	// La liste de toutes les fiches 
     
    	public List getTouteFiche(){
    		 Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
    		 return session.createQuery("from GC_Fiche").list();
    	}
     
    	//  La liste des fiches par projet 
     
    	public List getFicheparprojet(GC_Projet pj){
    		 Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
    		 return session.createQuery("from GC_Fiche where ID_PROJET = "+ pj.getIdProjet()).list();
    	}
     
    	// la liste des projets 
     
    	public List getToutprojet(){
    		 Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
    		 return session.createQuery("from GC_Projet").list();
     
       // la liste des documents
    	}
    	public List getToutdocument(){
    		 Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
    		 return session.createQuery("from GC_Document").list();
     
      // la liste des catagories 
    	}
    	public List getToutcategorie(){
    		 Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		 session.beginTransaction();
    		 return session.createQuery("from GC_Categorie").list();
    	}
     
    	// Modification d'une fiche 
     
    	/*public void modificationfiche(GC_Fiche f,long idf)
    	{
     
     
    	Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    	session.beginTransaction();
    	 Date datesys = new java.sql.Date(System.currentTimeMillis());
    	String hqlUpdate = "update GC_Fiche f set " +
    			           "f.AUTEUR =" + f.getAuteur()+ 
    			           ",f.SUJET="+f.getSujet()+
    	                   ",f.CORPS" + f.getCorps()+
    	                   ",f.LANGUE"+ f.getLangue()+
    	                  ",f.GROUPE"+f.getGroupe()+
    	                  ",f.DESCRIPTION"+f.getDescription()+
    	                  ",f.REFERENCE_EXTERNE"+f.getReference_externe()+
    	                  ",f.MAIL"+f.getMail()+
    	                  ",f.COMMENTAIRES"+f.getCommentaires()+
    	                  ",f.ETAT"+f.getEtat()+
    	                  ",f.OPINION"+f.getOpinion()+
    	               ",f.DATE_MODIFICATION"+  datesys+
    	               ",f.ID_PROJET"+ f.getProjet().getIdProjet()+
    	               ",f.ID_CATEGORIE"+f.getCategorie().getIdCategorie()+
    	               ",f.ID_DOCUMENT"+ f.getDocument().getIdDocument()+"where ID_FICHE="+idf;
    	int updatedEntities = session.createQuery(hqlUpdate).executeUpdate();
     
    	session.save(f);
    	session.getTransaction().commit();
    	session.close();
    	}
    	*/
     
    	// Modification d'une fiche
     
    	public void  modificationfiche(GC_Fiche f)
    	{
     
    	Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    	session.beginTransaction();
    	 //f = (GC_Fiche) session.load(GC_Fiche.class, f.getIdFiche());
    	 //f = (GC_Fiche) session.load(f.getIdFiche(), LockMode.UPGRADE);
         session.update(f);
      	session.save(f);
    	session.getTransaction().commit();
    	session.close();
     
    	}
    	// Supression d'une fiche
    	public void  supressionfiche(GC_Fiche f)
    	{
     
    	Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    	session.beginTransaction();
    	 //f = (GC_Fiche) session.load(GC_Fiche.class, f.getIdFiche());
    	 //f = (GC_Fiche) session.load(f.getIdFiche(), LockMode.UPGRADE);
         session.delete(f);
      	session.save(f);
    	session.getTransaction().commit();
    	session.close();
     
    	}
     
     
     
     
    	// load projet 
     
    	public GC_Projet loadprojet(long idp)
     
    	{
    		Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		session.beginTransaction();
    		GC_Projet pj = ( GC_Projet) session.load(GC_Projet.class,idp);
    		session.getTransaction().commit();
    		session.close();
    		 return pj;
    	}
     
    // load categorie
     
    	public GC_Categorie loadcategorie(long idc)
     
    	{
    		Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		session.beginTransaction();
    		GC_Categorie cat = ( GC_Categorie) session.load(GC_Categorie.class,idc);
    		session.getTransaction().commit();
    		session.close();
    		 return cat;
    	}
     
    // load document
     
    	public GC_Document loaddocument(long idd)
     
    	{
    		Session session=HibernateUtil.getSessionFactory().getCurrentSession();
    		session.beginTransaction();
    		GC_Document doc = ( GC_Document) session.load(GC_Document.class,idd);
    		session.getTransaction().commit();
    		session.close();
    		 return doc;
    	}
     
    }
    la classe GC_Projet
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    package metier;
    import java.io.Serializable;
    import java.util.HashSet;
    import java.util.Set;
     
    import metier.GC_Fiche;
    public class GC_Projet implements Serializable{
     
    	private Long idProjet;
    	private String libelle_projet;
    	private Set fiches = new HashSet();
     
    	/* Constructeur pas defaut */
     
    	public  GC_Projet(){}
     
    	/*  Constructeur de recopie */
     
    	public GC_Projet(String libelle_projet) {
    		super();
    		this.libelle_projet = libelle_projet;
    	}
    	/*les Getters et les Setters*/
     
    	public Long getIdProjet() {
    		return idProjet;
    	}
    	public void setIdProjet(Long idProjet) {
    		this.idProjet = idProjet;
    	}
    	public String getLibelle_projet() {
    		return libelle_projet;
    	}
    	public void setLibelle_projet(String libelle_projet) {
    		this.libelle_projet = libelle_projet;
    	}
    	public Set getFiches() {
    		return fiches;
    	}
    	public void setFiches(Set fiches) {
    		this.fiches = fiches;
    	}
    	public void addFiche(GC_Fiche f){
    		fiches.add(f);
    		f.setProjet(this);
    	}
     
     
    }
    la classe GC_Document

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    package metier;
     
    import java.io.Serializable;
    import java.util.HashSet;
    import java.util.Set;
     
    public class GC_Document implements Serializable
    {
    	private long idDocument;
    	private String titre ;
    	private String description_doc;
    	private String langue;
    	private String emplacement;
    	private String type_doc;
    	private String ss_type;
    	private Set fiches = new HashSet();
    	public GC_Document(){}
     
    	public GC_Document(String titre, String description_doc, String langue,
    			String emplacement, String type_doc, String ss_type) {
    		super();
    		this.titre = titre;
    		this.description_doc = description_doc;
    		this.langue = langue;
    		this.emplacement = emplacement;
    		this.type_doc = type_doc;
    		this.ss_type = ss_type;
     
    	}
     
    	public long getIdDocument() {
    		return idDocument;
    	}
     
    	public void setIdDocument(long idDocument) {
    		this.idDocument = idDocument;
    	}
     
    	public String getTitre() {
    		return titre;
    	}
     
    	public void setTitre(String titre) {
    		this.titre = titre;
    	}
     
    	public String getDescription_doc() {
    		return description_doc;
    	}
     
    	public void setDescription_doc(String description_doc) {
    		this.description_doc = description_doc;
    	}
     
    	public String getLangue() {
    		return langue;
    	}
     
    	public void setLangue(String langue) {
    		this.langue = langue;
    	}
     
    	public String getEmplacement() {
    		return emplacement;
    	}
     
    	public void setEmplacement(String emplacement) {
    		this.emplacement = emplacement;
    	}
     
    	public String getType_doc() {
    		return type_doc;
    	}
     
    	public void setType_doc(String type_doc) {
    		this.type_doc = type_doc;
    	}
     
    	public String getSs_type() {
    		return ss_type;
    	}
     
    	public void setSs_type(String ss_type) {
    		this.ss_type = ss_type;
    	}
     
    	public Set getFiches() {
    		return fiches;
    	}
     
    	public void setFiches(Set fiches) {
    		this.fiches = fiches;
    	}
     
    	public void addFiche(GC_Fiche f){
    		fiches.add(f);
    		f.setDocument(this);
    	}
     
     
    }
    la classe GC_Categorie

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    package metier;
     
    import java.io.Serializable;
    import java.util.HashSet;
    import java.util.Set;
     
    public class GC_Categorie implements Serializable {
     
    	private long idCategorie;
    	private String libelle_categorie;
    	private Set fiches = new HashSet();
     
    	public GC_Categorie(){}
     
    	public GC_Categorie(String libelle_categorie) {
    		super();
    		this.libelle_categorie = libelle_categorie;
    	}
    	public long getIdCategorie() {
    		return idCategorie;
    	}
    	public void setIdCategorie(long idCategorie) {
    		this.idCategorie = idCategorie;
    	}
    	public String getLibelle_categorie() {
    		return this.libelle_categorie;
    	}
    	public void setLibelle_categorie(String libelle_categorie) {
    		this.libelle_categorie = libelle_categorie;
    	}
    	public Set getFiches() {
    		return fiches;
    	}
    	public void setFiches(Set fiches) {
    		this.fiches = fiches;
    	}
     
    	public void addFiche(GC_Fiche f){
    		fiches.add(f);
    		f.setCategorie(this);
    	}
     
    }
    voici tous mes codes , je n'arrive pas à trouver l'erreur et je bloque la dessous
    j'ai essayé ce que tu m'as dit Tanebisse mais ca n'a pas marché !

    je vous remercie pour vos effort avec moi .

  20. #20
    Membre habitué
    Inscrit en
    Mars 2008
    Messages
    254
    Détails du profil
    Informations personnelles :
    Âge : 41

    Informations forums :
    Inscription : Mars 2008
    Messages : 254
    Points : 188
    Points
    188
    Par défaut Salut
    Salut Siham:

    Tu peux nous montrer ton fichier struts-config.xml


    Merci

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Charger une JComboBox ou une JList des données d'un champ d'une table dans une BDD.
    Par MasterMbg dans le forum Codes sources à télécharger
    Réponses: 2
    Dernier message: 27/09/2013, 12h16
  2. Réponses: 6
    Dernier message: 22/07/2013, 16h24
  3. copier une table d'une BDD dans une table d'une autre BDD
    Par faniette dans le forum C++Builder
    Réponses: 2
    Dernier message: 15/05/2013, 10h17
  4. Réponses: 7
    Dernier message: 25/03/2011, 10h52
  5. [AC-2003] insert des données d'une table dans une table d'une base externe
    Par marieo dans le forum VBA Access
    Réponses: 1
    Dernier message: 30/11/2009, 14h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo