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 :

Pb tableau


Sujet :

Struts 1 Java

  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 4
    Points : 2
    Points
    2
    Par défaut Pb tableau
    Bonjour,
    je débute avec struts et j'ai un petit pb avec un tableau.Dans ma jsp j'affiche bien le tableau avec les données mais lorsque je submit la page (bouton valider ou annuler) et avant d'arriver à la methode validate(), j'ai la stack suivante :

    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
     
    description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
     
    exception 
     
    javax.servlet.ServletException: BeanUtils.populate
    	org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
    	org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
    	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
    	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
     
     
    cause mère 
     
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    	java.util.ArrayList.RangeCheck(ArrayList.java:547)
    	java.util.ArrayList.get(ArrayList.java:322)
    	org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:521)
    	org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:428)
    	org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:750)
    	org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
    	org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881)
    	org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
    	org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
    	org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
    	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
    	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    je vous donne le code necessaire afin de trouver l'anomalie

    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
    46
    47
    48
    49
    50
    51
    52
    53
     
    <%@ page contentType="text/html; charset=Cp1252"%>
    <%@ taglib uri="/tags/struts-bean" prefix="bean"%>
    <%@ taglib uri="/tags/struts-logic" prefix="logic"%>
    <%@ taglib uri="/tags/struts-html" prefix="html"%>
     
     
    <script type="text/javascript" src="<%= request.getContextPath() %>/js/tritableaux.js"></script>
     
    <html:form method="POST" action="/ContactModifSetupAction" >
     
    	<table width="100%">
    		<tr>
    			<td class="font2"><bean:message key="modifContacts.titre" /></td>
    		</tr>
    	</table>
     
    	<table>
    		<tr>
    			<td colspan="100%"><html:errors /></td>
    		</tr>
    	</table>
     
    	<table id="tableContacts" class="avecBordureBleueVide marges" width="100%">
    		<tr class="avecBordureBleuePleine enteteTableau">
    			<th><bean:message key="entete.Nom" /></th>
    			<th><bean:message key="entete.Adresse1" /></th>
    			<th><bean:message key="entete.Adresse2" /></th>
    			<th><bean:message key="entete.CodePostal" /></th>
    			<th><bean:message key="entete.Ville" /></th>
    			<th><bean:message key="entete.Telephone" /></th>
    			<th><bean:message key="entete.Fax" /></th>
    			<th><bean:message key="entete.SiteWeb" /></th>
    			<th><bean:message key="entete.AdresseMail" /></th>
    		</tr>
     
    		<logic:iterate name="ContactModifForm" property="contacts" indexId="index" id="contact">
    			<tr>
    				<td><html:text name="ContactModifForm" property='<%="contacts["+index+"].nom"%>' /></td>
    				<td><html:text name="ContactModifForm" property='<%="contacts["+index+"].adresse.adresse1"%>' /></td>
    				<td><html:text name="ContactModifForm" property='<%="contacts["+index+"].adresse.adresse2"%>' /></td>
    				<td><html:text name="ContactModifForm" property='<%="contacts["+index+"].adresse.codePostal"%>' /></td>
    				<td><html:text name="ContactModifForm" property='<%="contacts["+index+"].adresse.ville"%>' /></td>
    				<td><html:text name="ContactModifForm" property='<%="contacts["+index+"].adresse.tel"%>' /></td>
    				<td><html:text name="ContactModifForm" property='<%="contacts["+index+"].adresse.fax"%>' /></td>
    				<td><html:text name="ContactModifForm" property='<%="contacts["+index+"].adresse.siteWeb"%>' /></td>
    				<td><html:text name="ContactModifForm" property='<%="contacts["+index+"].adresse.e_Mail"%>' /></td>
    			</tr>
    		</logic:iterate>
    	</table>
    	<html:submit property="actionContactModif" title="valider"><bean:message key="btn.valider" /></html:submit>
    	<html:submit property="actionContactModif" title="annuler"><bean:message key="btn.annuler" /></html:submit>
    </html:form>
    Action
    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
     
    package com.altimate.crm.actions.contact;
     
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
     
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
     
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.actions.LookupDispatchAction;
     
    import com.altimate.crm.beans.contact.ContactModifBean;
    import com.altimate.crm.daos.core.AccesDAO;
    import com.altimate.crm.daos.core.AccesDAOFactory;
    import com.altimate.crm.dtos.contact.ContactDTO;
    import com.altimate.crm.exception.AltimateException;
    import com.altimate.crm.forms.contact.ContactModifForm;
     
    public class ContactModifAction extends LookupDispatchAction {
     
      AccesDAO contactDAO =AccesDAOFactory.getDAO("contact");
     
      protected Map<String, String> getKeyMethodMap() {
        HashMap<String, String> mapAction = new HashMap<String, String>();
        mapAction.put("btn.valider", "Valider");
        mapAction.put("btn.annuler", "Annuler");
        return mapAction;
      }
     
    	public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException  {
     
    	  ContactModifForm contactModifForm = (ContactModifForm) form;
    		AccesDAO contactDAO =AccesDAOFactory.getDAO("contact");
    		ContactDTO contactDTO=null;
    		List<ContactModifBean> contacts=new ArrayList<ContactModifBean>();
     
    		String destination = null;
     
    		// Récupération des Ids à modifier
    		String[] idsAModifier = (String[]) request.getSession().getAttribute("idsAModifier");
     
    	    try {
    	       for (Object element : idsAModifier) {
    	         ContactModifBean contactModifBean = new ContactModifBean();
    	         contactDTO = (ContactDTO) contactDAO.getDetail(null, (String)element);
    	         contactModifBean.copyProperties(contactDTO);
    	         //System.out.println("Nom ===> "+contactModifBean.getNom());
    	         contacts.add(contactModifBean);
    	       }
    	       destination = "modif";
    	      //stocke dans des beans pas dans les dtos
    	    } catch (AltimateException e) {
    	      //TODO ajouter dans la request un message d'erreur indiquant erreur globale
    	      return mapping.findForward("erreur");
    	    }
     
    		contactModifForm.setContacts(contacts);
        // On sauvegarde le bean en cas d'erreur
        request.getSession().setAttribute("contactModifBeans", contacts);
     
    		return mapping.findForward(destination);
    	}
     
      public ActionForward Annuler(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception  {
        return mapping.findForward("annuler");
      }
     
     
      public ActionForward Valider(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception  {
     
        ContactModifForm contactModifForm = (ContactModifForm) form;
        int indice = 0;
        String[] idsAModifier = (String[]) request.getSession().getAttribute("idsAModifier");
     
     
     
        // Contrôle des noms
        //try
        //{
          indice = 0;
          for (String element : idsAModifier )
          {
            indice++;
          }
          request.getSession().removeAttribute("IdsASup");
       // } //catch (AltimateException e) {
          // TODO Auto-generated catch block
          //e.printStackTrace();
        //}
     
     
     
        try
        {
          indice = 0;
          for (String element : idsAModifier )
          {
            ContactDTO contactDTO = (ContactDTO) contactDAO.getDetail(null, element);
            //contactDTO.copyProperties(contactModifForm.getContacts(indice));
            contactDAO.update(contactDTO, null);
            indice++;
          }
          request.getSession().removeAttribute("IdsASup");
        } catch (AltimateException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
     
        return mapping.findForward("valider");
      }
    }
    Form
    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
     
    package com.altimate.crm.forms.contact;
     
    import java.util.ArrayList;
    import java.util.List;
     
    import javax.servlet.http.HttpServletRequest;
     
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionMessage;
     
    import com.altimate.crm.beans.contact.ContactModifBean;
    import com.altimate.crm.utils.LibelleProperties;
     
    public class ContactModifForm extends ActionForm {
     
       private static final long serialVersionUID = 7848935115988283663L;
       //private ContactModifBean contact=new ContactModifBean();
       private String actionContactModif;
       private List<ContactModifBean> contacts=new ArrayList<ContactModifBean>();
     
     
       public ContactModifForm() {
         System.out.println("Taille de contacts =========> + "+contacts.size());
       }
     
       public String getActionContactModif() {
        return actionContactModif;
      }
      public void setActionContactModif(String actionContactModif) {
        this.actionContactModif = actionContactModif;
      }
      public List<ContactModifBean> getContacts() {
        return contacts;
      }
     
      public void setContacts(List<ContactModifBean> contacts) {
        this.contacts = contacts;
      }
     
     
     
      public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
     
        ActionErrors errors = new ActionErrors();
        ActionMessage msg;
     
        // Recherche des libellés des boutons dans le fichier properties
        final String  VALIDER = LibelleProperties.getRessource("btn.valider");
        final String  ANNULER = LibelleProperties.getRessource("btn.annuler");
     
        // Demande de validation
        if (VALIDER.equals(actionContactModif))
        {
     
        }
     
     
        if (ANNULER.equals(actionContactModif))
        {      
     
          if (contacts !=null &&  !contacts.isEmpty()){
     
          for (ContactModifBean w : contacts)
          {
            System.out.println("Bonjour, je m'appelle : "+w.getNom());
          }
          }
        }
     
     
        return errors;
      }
     
     
    }
    Bean
    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 com.altimate.crm.beans.contact;
     
    import java.io.Serializable;
     
    import com.altimate.crm.beans.adresse.AdresseBean;
    import com.altimate.crm.dtos.contact.ContactDTO;
     
    public class ContactModifBean implements Serializable {
    	/**
             * 
             */
    	private static final long serialVersionUID = -7460275223885580660L;
    	protected int id;
    	protected String nom;
    	protected AdresseBean adresse;
     
      public ContactModifBean(){
    		adresse = new AdresseBean();
    	}
     
    	public int getId() {
    		return id;
    	}
    	public void setId(int id) {
    		this.id = id;
    	}
    	public String getNom() {
    		return nom;
    	}
    	public void setNom(String nom) {
    		this.nom = nom;
    	}
     
    	public AdresseBean getAdresse() {
    		return adresse;
    	}
     
    	public void setAdresse(AdresseBean adresse) {
    		this.adresse = adresse;
    	}
     
    	public void copyProperties(ContactDTO contactDTO){
    		this.id=contactDTO.getId();
    		this.nom=contactDTO.getNom();
    		this.adresse.copyProperties(contactDTO.getAdresse());
    	}
     
    }
    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
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!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>
    	<data-sources>
     
    	</data-sources>
    	<form-beans>
    		<form-bean name="TacheForm"
    			type="com.altimate.crm.forms.tache.TacheForm" />
    		<form-bean name="LoginForm"
    			type="com.altimate.crm.forms.login.LoginForm" />
    		<form-bean name="ContactAffForm"
    			type="com.altimate.crm.forms.contact.ContactAffForm" />
    		<form-bean name="ContactListForm"
    			type="com.altimate.crm.forms.contact.ContactListForm" />
    		<form-bean name="ContactAjoutForm"
    			type="com.altimate.crm.forms.contact.ContactAjoutForm" />
    		<form-bean name="ContactModifForm"
    			type="com.altimate.crm.forms.contact.ContactModifForm" />
    		<form-bean name="ContactSupForm"
    			type="com.altimate.crm.forms.contact.ContactSupForm" />
     
    		<form-bean name="SocieteListForm"
    			type="com.altimate.crm.forms.societe.SocieteListForm" />
    	</form-beans>
     
    	<global-exceptions></global-exceptions>
    	<global-forwards></global-forwards>
     
    	<action-mappings>
     
    		<action path="/AccueilForward" forward="/accueil.jsp"></action>
     
    		<action path="/ContactListForwardAction" forward="/contactList.jsp" ></action>
     
    		<action path="/ContactAjoutForwardAction" forward="/contactAjout.jsp"></action>
     
    		<action path="/ContactModifForwardAction" forward="/contactModif.jsp"></action>
     
    		<action path="/ContactSupForwardAction" forward="/contactSup.jsp"></action>
     
    		<action path="/EndSession" forward="/stopSession.jsp"></action>
     
    		<action path="/LoginForward" forward="/Connexion.jsp"></action>
     
    		<action path="/SocieteListForwardAction" forward="/societeList.jsp"></action>
     
    		<action path="/SocieteAjoutForwardAction" forward="/societeAjout.jsp"></action>
     
    		<action path="/SocieteModifForwardAction" forward="/societeModif.jsp"></action>
     
    		<action path="/SocieteSupForwardAction" forward="/societeSup.jsp"></action>
     
     
    		<action path="/TacheForward" forward="/pages/tache/tache.jsp"></action>
     
    		<action path="/TacheListForward" forward="/pages/tache/tacheListe.jsp"></action>
     
     
     
    		<action path="/LoginAction" name="LoginForm"  
    			type="com.altimate.crm.actions.login.LoginAction" scope="request"
    			input="/Connexion.jsp">
    			<forward name="ok" path="/AccueilForward.do" />
    			<forward name="erreur" path="/LoginForward.do" />
    		</action>
     
    		<action path="/ContactListSetupAction" name="ContactListForm"
    			type="com.altimate.crm.actions.contact.ContactAction" scope="request"
    			validate="true"
    			input="/contactList.jsp"
    			parameter="actionContactList">
    			<forward name="ok" path="/ContactListForwardAction.do" />
    			<forward name="erreur" path="/ContactListForwardAction.do" />
    			<forward name="ajouter" path="/ContactAjoutForwardAction.do" />
    			<forward name="modifier" path="/ContactModifSetupAction.do" />
    			<forward name="supprimer" path="/ContactSupSetupAction.do" /> 
    		</action>
     
    		<action path="/ContactAjoutSetupAction" name="ContactAjoutForm"
    			type="com.altimate.crm.actions.contact.ContactAjoutAction" scope="request"
    			input="/contactAjout.jsp"
    			parameter="actionContactAjout">
      			<forward name="ok" path="/ContactListSetupAction.do" /> 
      			<forward name="erreur" path="/ContactListForwardAction.do" /> 
      		</action>
     
    		<action path="/ContactModifSetupAction" name="ContactModifForm"
      		 	type="com.altimate.crm.actions.contact.ContactModifAction" scope="request"
      		 	input="/pages/contacts/modifContacts.jsp"
      		 	parameter="actionContactModif">
      			<forward name="valider" path="/ContactListSetupAction.do" />
      			<forward name="annuler" path="/ContactListSetupAction.do" />
      			<forward name="modif" path="/ContactModifForwardAction.do" /> 
      			<forward name="erreur" path="/ContactListForwardAction.do" /> 
      		</action>
     
    		<action path="/ContactSupSetupAction" name="ContactSupForm"
      		 	type="com.altimate.crm.actions.contact.ContactSupAction" scope="request"
      		 	input="/contactSup.jsp"
      		 	parameter="actionContactSup">
      			<forward name="ok" path="/ContactListSetupAction.do" />
      			<forward name="sup" path="/ContactSupForwardAction.do" />
      			<forward name="valider" path="/ContactListSetupAction.do" />
      			<forward name="annuler" path="/ContactListSetupAction.do" /> 
      			<forward name="erreur" path="/ContactListForwardAction.do" /> 
      		</action>
     
    		<action path="/SocieteListSetupAction" name="SocieteListForm"
    			type="com.altimate.crm.actions.societe.SocieteAction" scope="request"
    			input="/societeList.jsp">
    			<forward name="ok" path="/SocieteListForwardAction.do" />
    			<forward name="erreur" path="/SocieteListForwardAction.do" />
    			<forward name="ajouter" path="/SocieteAjoutForwardAction.do" />
    			<forward name="modifier" path="/SocieteModifSetupAction.do" />
    			<forward name="supprimer" path="/SocieteSupSetupAction.do" /> 
    		</action>
     
    		<action path="/SocieteAjoutSetupAction" name="SocieteAjoutForm"
    			type="com.altimate.crm.actions.societe.SocieteAjoutAction" scope="request"
    			input="/societeAjout.jsp">
      			<forward name="ok" path="/SocieteListSetupAction.do" /> 
      			<forward name="erreur" path="/SocieteListForwardAction.do" /> 
      		</action>
     
    		<action path="/SocieteModifSetupAction" name="SocieteModifForm"
      		 	type="com.altimate.crm.actions.societe.SocieteModifAction" scope="request"
      		 	input="/societeModif.jsp">
      			<forward name="ok" path="/SocieteListSetupAction.do" />
      			<forward name="modif" path="/SocieteModifForwardAction.do" /> 
      			<forward name="erreur" path="/SocieteListForwardAction.do" /> 
      		</action>
     
    		<action path="/SocieteSupSetupAction" name="SocieteSupForm"
      		 	type="com.altimate.crm.actions.societe.SocieteSupAction" scope="request"
      		 	input="/SocieteSup.jsp"
      		 	parameter="actionSocieteSup">
      			<forward name="ok" path="/SocieteListSetupAction.do" />
      			<forward name="sup" path="/SocieteSupForwardAction.do" />
      			<forward name="valider" path="/SocieteListSetupAction.do" />
      			<forward name="annuler" path="/SocieteListSetupAction.do" /> 
      			<forward name="erreur" path="/SocieteListForwardAction.do" /> 
      		</action>
     
    		<action path="/TacheAction" name="TacheForm"
    			type="com.altimate.crm.actions.tache.TacheAction" scope="request"
    			input="/pages/tache/tacheListe.jsp">
    			<forward name="end" path="/TacheForward.do" />
    		</action>
     
    		<action path="/TacheListSetupAction" name="TacheForm"
    			type="com.altimate.crm.actions.tache.TacheAction" scope="request"
    			parameter="setup">
    			<forward name="ok" path="/TacheListForward.do" />
    			<forward name="erreur" path="/TacheListForward.do" />
    		</action>
     
    	</action-mappings>
     
    	<controller
    		processorClass="com.altimate.crm.servlet.MonRequestProcessor" />
    	<message-resources parameter="properties.Application" />
    	<plug-in className="org.apache.struts.tiles.TilesPlugin">
    		<set-property property="definitions-config"
    			value="/WEB-INF/tiles-defs.xml" />
    		<set-property property="moduleAware" value="true" />
    	</plug-in>
    	<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    		<set-property property="pathnames"
    			value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
    	</plug-in>
    </struts-config>
    Aprés plusieurs jours de recherche, je ne comprends toujours pas mon probleme.
    Je vous remercie de votre intéret à mon pb.

  2. #2
    Candidat au Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 4
    Points : 2
    Points
    2
    Par défaut
    Bonjour,

    j'ai essayé de changer le scope en le mettant en session mais cela produit le même resultat.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    		<action path="/ContactModifSetupAction" name="ContactModifForm"
      		 	type="com.altimate.crm.actions.contact.ContactModifAction" scope="session"
      		 	input="/pages/contacts/modifContacts.jsp"
      		 	parameter="actionContactModif">
      			<forward name="valider" path="/ContactListSetupAction.do" />
      			<forward name="annuler" path="/ContactListSetupAction.do" />
      			<forward name="modif" path="/ContactModifForwardAction.do" /> 
      			<forward name="erreur" path="/ContactListForwardAction.do" /> 
      		</action>
    Je n'arrive toujours pas à voir mon probleme.
    Je vous remercie d'avance de votre aide

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Février 2007
    Messages
    140
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Février 2007
    Messages : 140
    Points : 170
    Points
    170
    Par défaut
    Bonjour,

    Je pense que ton problème vient de ta JSP où tu utilises sachant que ton objet contacts est une List et non pas un tableau d'objet .. donc tu ne peut pas y accéder comme celà mais plutôt comme ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    contacts.get(int index)

  4. #4
    Candidat au Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 4
    Points : 2
    Points
    2
    Par défaut
    Bonjour lucimed,

    merci pour ta réponse.
    Par contre mon problème n'est pas à l'affichage de la page mais à sa validation.
    C'est à dire que la page va bien chercher les données dans la List pour les afficher. Par contre lorsque je soumet cette page avec le bouton "Valider" ou "Annuler" j'ai l'impression que la List est vide et que c'est ça qui fait planter l'appli.

    Si tu as une idée n'hésite pas.
    Encore merci.

  5. #5
    Membre habitué
    Profil pro
    Inscrit en
    Février 2007
    Messages
    140
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Février 2007
    Messages : 140
    Points : 170
    Points
    170
    Par défaut
    Bonjour,

    Essaye de mettre des logs dans ton action, dans ton form et aussi dans ta JSP (tu peux faire des alert JS avec des infos sur ta liste lors du clic des btn ou utiliser firebug ...) pour voir où ça plante exactement ...

    Essaye également de commenter dans ta JSP l'édition des adresses et tout le reste ... laisse juste le nom qui est une propriété de type String du Bean (en gros c'est pour tester si ça fonctionne quand tu ne fait pas appel à une propriété de type Objet ... pour voir d'où vient le prob exactement)

    Sinon si tu peux mettre en PJ ton code .. ça sera plus simple !

  6. #6
    Candidat au Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 4
    Points : 2
    Points
    2
    Par défaut
    Bonjour lucimed,

    j'ai trouvé l'erreur ajourd'hui. C'est bien une erreur de débutant.
    Finalement avec le tag <logic:iterate> l'attribut id correspond à un enregistrement de la List définie dans l'attribut property.
    Il faut ensuite, dans le tag <html:text>, mettre l'attribut name avec le nom de l'id puis dans la property mettre la zone de la List.

    Voici le morceau de code modifié de la 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
     
    		<logic:iterate name="ContactModifForm" property="contacts" indexId="index" id="contact">
    			<tr>
    				<td><html:text name="contact" property="nom" /></td>
    				<td><html:text name="contact" property="adresse.adresse1" /></td>
    				<td><html:text name="contact" property="adresse.adresse2" /></td>
    				<td><html:text name="contact" property="adresse.codePostal" /></td>
    				<td><html:text name="contact" property="adresse.ville" /></td>
    				<td><html:text name="contact" property="adresse.tel" /></td>
    				<td><html:text name="contact" property="adresse.fax" /></td>
    				<td><html:text name="contact" property="adresse.siteWeb" /></td>
    				<td><html:text name="contact" property="adresse.e_Mail" /></td>
    			</tr>
    		</logic:iterate>
    Je te remercie de ton aide.

  7. #7
    Membre habitué
    Profil pro
    Inscrit en
    Février 2007
    Messages
    140
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Février 2007
    Messages : 140
    Points : 170
    Points
    170
    Par défaut
    Bon tout est bien qui fini bien !!
    Bonne continuation

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. trier un tableau et compter des elements du tableau
    Par remi51 dans le forum Algorithmes et structures de données
    Réponses: 6
    Dernier message: 17/06/2002, 16h51
  2. Réponses: 2
    Dernier message: 27/05/2002, 19h46
  3. verification de doublons dans un tableau
    Par bohemianvirtual dans le forum C
    Réponses: 11
    Dernier message: 25/05/2002, 12h21
  4. transmision de tableau en parametre
    Par Horus dans le forum C++Builder
    Réponses: 3
    Dernier message: 16/05/2002, 11h15
  5. Réponses: 4
    Dernier message: 13/05/2002, 16h43

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