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 :

lien <html:link> dans un logic:iterate, update de chaque row


Sujet :

Struts 1 Java

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut lien <html:link> dans un logic:iterate, update de chaque row
    bonjour ,
    dans une page jsp, je recupere une liste d'enregistrements de la base de donnee
    et cette liste je l'affiche row par row, et devant chaque row , j'ajoute un lien <html:link> , edit
    une fois l'user clique sur edit
    je passe chaque champs (bean:write) en champs editable (html:text)
    le probleme est comment puis je ajouter en parametre au lien les nouvelle modifs
    du user

    Merci d'avance pour l'aide

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut
    svp , c'est vraiment urgent , je dois livrer :-(
    ce dessous le code

    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
    		<logic:notEqual name="userIt" property="userEditMode" value="0">
    						<td
    							style="width: 615px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px;">
    						&nbsp; <span style="font-size: 10pt"> <html:text
    							property="userNom" style="width: 132px" name="userIt" /></span></td>
    						<td
    							style="width: 23004px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: left;">
    						<span style="font-size: 10pt"> <html:text
    							style="width: 127px" name="userIt" property="userPrenom" /></span></td>
    						<td
    							style="width: 9113px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    						<span style="font-size: 10pt"> <html:text
    							style="width: 63px" name="userIt" property="userIdentifiant" /></span></td>
    						<td
    							style="width: 10320px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    						<span style="font-size: 10pt"> <html:text
    							style="width: 63px" name="userIt" property="userPwd" /></span></td>
    						<td
    							style="width: 15787px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    						<span style="font-size: 10pt"> <nested:root name="userIt">
    							<nested:nest property="profil">
    								<nested:select property="profilId">
    									<nested:optionsCollection name="userEditForm"
    										property="profilsList" value="profilId" label="profilLabel" />
    								</nested:select>
    							</nested:nest>
    						</nested:root> </span></td>
    						<td
    							style="border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; width: 4299px; border-bottom: #f0f8ff 1px solid; height: 26px; background-color: #f0f8ff">
    						<span style="font-size: 10pt"> <nested:root name="userIt">
    							<nested:nest property="statut">
    								<nested:select property="statutId">
    									<nested:optionsCollection name="userEditForm"
    										property="statutsList" value="statutId" label="statutLabel" />
    								</nested:select>
    							</nested:nest>
    						</nested:root> </span></td>
     
    						<bean:define id="uNom" name="userIt" property="userNom" />
    						<bean:define id="uPrenom" name="userIt" property="userPrenom" />
    						<bean:define id="uIdentifiant" name="userIt"
    							property="userIdentifiant" />
    						<bean:define id="uPwd" name="userIt" property="userPwd" />
     
    						<%
    								java.util.HashMap params = new java.util.HashMap();
    								params.put("userNom", uNom);
    								params.put("userPrenom", uPrenom);
    								params.put("userIdentifiant", uIdentifiant);
    								params.put("userPwd", uPwd);
    								//params.put("UserProfilLabel", uProfil);
    								//params.put("statutLabel", ustatutLabel);
    								pageContext.setAttribute("paramsName", params);
    						%>
    						<td
    							style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    						&nbsp; <html:link
    							action="EditUsers.do?do=updateUser&userEditMode=0"
    							name="paramsName">
    							<img src="img\valid.jpg" style="width: 20px" />
    						</html:link></td>
    					</logic:notEqual>

  3. #3
    Expert confirmé

    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
    Par défaut
    Le problème c'est que, lorsqu'on clique sur un lien, le formulaire n'est pas soumis.
    Donc, les paramètres passés en paramètres du lien contiendront les anciennes valeurs et non les valeurs modifiées.

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut
    je vous relance les gars si jamais vous avez une idee
    merci
    Sallemel

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut
    bon la j'avance un tout ptit peu :
    pour la modification de chaque row, j'ai fait un submit avec comme propriete
    updateUserButton
    et au niveau du form j'ai ajoute une methode setter
    pour ce submit : setUpdateUserButton :
    voici le code :
    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
     
    <nested:form action="EditUsers.do?do=ListUsers">
    <nested:iterate  property="users">
    <tr>
    <nested:equal property="userEditMode" value="0">
    <td
    style="width: 9543px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: left; height: 24px;">
    <span style="font-size: 10pt"><nested:write property="userNom" /></span></td>
    <td
    	style="width: 23004px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: left; height: 24px;">
    						<span style="font-size: 10pt"><nested:write property="userPrenom" /></span></td>
    <td
    	style="width: 9113px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: center; height: 24px;">
    <span style="font-size: 10pt"><nested:write property="userIdentifiant" /></span></td>
    <td	style="width: 10320px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: center; height: 24px;">
    <span style="font-size: 10pt"><nested:write 						property="userPwd" /></span></td>
    <td	style="width: 15787px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px; text-align: center;">
    <span style="font-size: 10pt"></span> 
    	<nested:nest property="profil">
    	<nested:write property="profilLabel" />
    	</nested:nest>
    </td>
    <td
    style="border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; width: 4299px; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px; text-align: center;">
    <span style="font-size: 10pt">
    	<nested:nest property="statut">
    								<nested:write property="statutLabel" />
    							</nested:nest>
    </span></td>
    <td
    style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    	&nbsp;<nested:submit property="editUserButton" >modifier</nested:submit></td>
    </nested:equal>
    <nested:notEqual  property="userEditMode" value="0">
    <td style="width: 615px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px;">
    &nbsp; <span style="font-size: 10pt"> <nested:text
    	property="userNom" style="width: 132px"  /></span></td>
    <td
    style="width: 23004px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: left;">
    <span style="font-size: 10pt"> <nested:text 
    	style="width: 127px"  property="userPrenom" /></span></td>
    <td
    style="width: 9113px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> <nested:text
    	style="width: 63px" property="userIdentifiant" maxlength="8" /></span></td>
    <td
    	style="width: 10320px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> <nested:text
    							style="width: 63px" property="userPwd" maxlength="8"/></span></td>
    						<td
    							style="width: 15787px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> 
    <nested:nest property="profil">
    <nested:select property="profilId">
    <nested:optionsCollection name="userEditForm"
    property="profilsList" value="profilId" label="profilLabel" />
    							</nested:select>
    	</nested:nest>
     
    </span></td>
    <td
    style="border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; width: 4299px; border-bottom: #f0f8ff 1px solid; height: 26px; background-color: #f0f8ff">
    <span style="font-size: 10pt">
    <nested:nest property="statut"> 
    <nested:select property="statutId">
    <nested:optionsCollection name="userEditForm"
    property="statutsList" value="statutId" label="statutLabel" />
    	</nested:select>
    	</nested:nest>
    </span></td>
    <td
    	style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    &nbsp; 
    <nested:submit property="updateUserButton" >valider</nested:submit>
    </td>
    </nested:notEqual>
    </tr>
    </nested:iterate>
    </nested:form>
    et voici les getter et les setter de la propriete users dans l'actionForm:
    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
     
    public class UserEditForm extends ActionForm {
     
    	public UserEditForm() {
    		// TODO Auto-generated constructor stub
    	}
     
     
    	Utilisateur user = new Utilisateur();
    	Utilisateur admin = new Utilisateur();
    		java.util.List<Statut> statutsList = new ArrayList<Statut>();
    	java.util.List<Profil> profilsList = new ArrayList<Profil>();
     
    	java.util.List<Utilisateur> users = new ArrayList<Utilisateur>();
    	/*@Override
    	public void reset(ActionMapping mapping, HttpServletRequest request) {
    		// TODO Auto-generated method stub
    		this.user=null;
    		this.admin=null;
    				this.users=null;
    	}*/
     
    	public Utilisateur getUser() {
    		return user;
    	}
    	public void setUser(Utilisateur user) {
    		this.user = user;
    	}
    	public java.util.List<Profil> getProfilsList() {
    		if (profilsList.isEmpty()) {
    			profilsList.add(new Profil(2, "Consultation"));
    			profilsList.add(new Profil(1, "Administrateur"));
    			profilsList.add(new Profil(3, "Modification"));
    		}
    		return profilsList;
    	}
     
     
    	public void setProfilsList(java.util.List<Profil> profilsList) {
    		this.profilsList = profilsList;
    	}
     
     
    	public String  getUserProfilLabel() {
    		return user.getProfil().getProfilLabel();
    	}
    	public void  setUserProfilLabel(String UserProfilLabel) {
    		user.getProfil().setProfilLabel(UserProfilLabel);
    	}
    	public String getUserStatutLabel()
    	{
    		return user.getStatut().getStatutLabel();
    	}
    	public void  setUserStatutLabel(String statutLabel) {
    		user.getStatut().setStatutLabel(statutLabel);
    	}
    	public Utilisateur getAdmin() {
    		return admin;
    	}
     
    	public void setAdmin(Utilisateur admin) {
    		this.admin = admin;
    	}
     
    	public Object[] getUsers() {
    		return this.users.toArray();
    	}
     
    	public void setUsers(Object [] usersParam) {
    		JOptionPane.showMessageDialog(null, "size="+usersParam.length);
    		this.users = new ArrayList<Utilisateur>();
    		    for (int i = 0; i < usersParam.length; i++) {
    		    	this.users.add((Utilisateur)usersParam[i]);
    		    }
    	}
     
    	public Set<DataMonitoring> getDataMonitorings() {
    		return user.getDataMonitorings();
    	}
    	public Profil getProfil() {
    		if (user.getProfil()==null)
    			return new Profil(2,"Consultation");
    		else
    		return user.getProfil();
    	}
    	public Statut getStatut() {
    		if (user.getStatut()==null)
    			return new Statut(1,"ACTIF");
    		else
    		return user.getStatut();
    	}
    	public int getUserEditMode() {
    		return user.getUserEditMode();
    	}
    	public int getUserId() {
    		return user.getUserId();
    	}
    	public String getUserIdentifiant() {
    		return user.getUserIdentifiant();
    	}
    	public String getUserNom() {
    		return user.getUserNom();
    	}
    	public String getUserPrenom() {
    		return user.getUserPrenom();
    	}
    	public String getUserPwd() {
    		return user.getUserPwd();
    	}
    	public void setDataMonitorings(Set<DataMonitoring> dataMonitorings) {
    		user.setDataMonitorings(dataMonitorings);
    	}
    	public void setProfil(Profil profil) {
    		user.setProfil(profil);
    	}
    	public void setStatut(Statut statut) {
    		user.setStatut(statut);
    	}
    	public void setUserEditMode(int userEditMode) {
    		user.setUserEditMode(userEditMode);
    	}
    	public void setUserId(int userId) {
    		user.setUserId(userId);
    	}
    	public void setUserIdentifiant(String userIdentifiant) {
    		user.setUserIdentifiant(userIdentifiant);
    	}
    	public void setUserNom(String userNom) {
    		user.setUserNom(userNom);
    	}
    	public void setUserPrenom(String userPrenom) {
    		user.setUserPrenom(userPrenom);
    	}
    	public void setUserPwd(String userPwd) {
    		user.setUserPwd(userPwd);
    	}
    	public boolean equals(Object arg0) {
    		return user.equals(arg0);
    	}
    	public int hashCode() {
    		return user.hashCode();
    	}
    	public String toString() {
    		return user.toString();
    	}
     
    	public java.util.List<Statut> getStatutsList() {
    		if (statutsList.isEmpty()) {
    			statutsList.add(new Statut(1,"ACTIF"));
    			statutsList.add(new Statut(0,"INACTIF"));
    			}
    		return statutsList;
    	}
    	public void setStatutsList(java.util.List<Statut> statutsList) {
    		this.statutsList = statutsList;
    	}
     
    }
    lors de l'affichage , c'est OK
    voici le code genere :
    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
     
    		<form name="userEditForm" method="post" action="/FirstProject/EditUsers.do?do=ListUsers">
    <tr>
    <td
    style="width: 615px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px;">
    &nbsp; <span style="font-size: 10pt"> <input type="text" name="users[0].userNom" value="sallem" style="width: 132px"></span></td>
    <td
    	style="width: 23004px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: left;">
    <span style="font-size: 10pt"> <input type="text" name="users[0].userPrenom" value="elyes" style="width: 127px"></span></td>
    <td
    	style="width: 9113px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    						<span style="font-size: 10pt"> <input type="text" name="users[0].userIdentifiant" maxlength="8" value="salleme" style="width: 63px"></span></td>
    <td
    	style="width: 10320px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    						<span style="font-size: 10pt"> <input type="text" name="users[0].userPwd" maxlength="8" value="sallem" style="width: 63px"></span></td>
    <td
    	style="width: 15787px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> 
    			<select name="users[0].profil.profilId"><option value="2">Consultation</option>
    <option value="1" selected="selected">Administrateur</option>
    <option value="3">Modification</option></select>
     
    </span></td>
    <td
    style="border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; width: 4299px; border-bottom: #f0f8ff 1px solid; height: 26px; background-color: #f0f8ff">
    						<span style="font-size: 10pt">
    <select name="users[0].statut.statutId"><option value="1" selected="selected">ACTIF</option>
    <option value="0">INACTIF</option></select>
    </span></td>
    <td
    	style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    						&nbsp; 
    						<input type="submit" name="users[0].updateUserButton" value="valider">
    						</td>
    </tr>
    						<tr>
     
    						<td
    							style="width: 9543px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: left; height: 24px;">
    						<span style="font-size: 10pt">bouab</span></td>
    						<td
    							style="width: 23004px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: left; height: 24px;">
    						<span style="font-size: 10pt">mehdi</span></td>
    						<td
    							style="width: 9113px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: center; height: 24px;">
    						<span style="font-size: 10pt">bouabm</span></td>
    						<td
    							style="width: 10320px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: center; height: 24px;">
    						<span style="font-size: 10pt">mehdi</span></td>
    						<td
    							style="width: 15787px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px; text-align: center;">
    						<span style="font-size: 10pt"></span> 
     
    								Consultation
     
    						</td>
    						<td
    							style="border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; width: 4299px; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px; text-align: center;">
    						<span style="font-size: 10pt">
     
    								ACTIF
     
    						</span></td>
     
    						<td
    							style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    						&nbsp;<input type="submit" name="users[1].editUserButton" value="modifier"></td>
     
     
     
    				</tr>
     
    																	<tr>
     
     
    						<td
    							style="width: 9543px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: left; height: 24px;">
    						<span style="font-size: 10pt">guy</span></td>
    						<td
    							style="width: 23004px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: left; height: 24px;">
    						<span style="font-size: 10pt">bernard</span></td>
    						<td
    							style="width: 9113px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: center; height: 24px;">
    						<span style="font-size: 10pt">guyb</span></td>
    						<td
    							style="width: 10320px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: center; height: 24px;">
    						<span style="font-size: 10pt">bernard</span></td>
    						<td
    							style="width: 15787px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px; text-align: center;">
    						<span style="font-size: 10pt"></span> 
     
    								Modification
     
    </td>
    <td
    style="border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; width: 4299px; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px; text-align: center;">
    <span style="font-size: 10pt">
    ACTIF
    </span></td>
    <td
    style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    &nbsp;<input type="submit" name="users[2].editUserButton" value="modifier"></td>
    </tr>
    </form>

    mais le probleme c'est lors de l'appel a valider
    il me retourne cette erreur :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    java.lang.ArrayIndexOutOfBoundsException
    	java.lang.reflect.Array.get(Native Method)
    	org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:437)
    	org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:340)
    	org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:664)
    merci d'avoir lu jusqu'au bout
    sallemel

  6. #6
    Expert confirmé

    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
    Par défaut
    Il faut définir le scope du form-bean userEditForm à session dans le mapping de l'Action.

  7. #7
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut
    Hello c_nvy,
    tout a fait, avec scope sette a session, ca commence a bouger
    par contre , il y a de nouvelles erreurs
    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
     
    GRAVE: Could not synchronize database state with session
    org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.thales.project.Statut
    	at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219)
    	at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397)
    	at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:78)
    	at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1997)
    	at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2371)
    	at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2307)
    	at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2607)
    	at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92)
    	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
    	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
    	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
    	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
    	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
    	at com.thales.project.dao.HibernateUtilisateurDAO.updateUtilisateurDAO(HibernateUtilisateurDAO.java:91)
    	at com.thales.project.Utilisateur.setUpdateUserButton(Utilisateur.java:130)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
    	at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
    	at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
    	at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
    	at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
    	at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
    	at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
    	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
    	at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
    	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
    	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    	at java.lang.Thread.run(Unknown Source)
    13 nov. 2008 12:13:21 com.thales.project.dao.HibernateUtilisateurDAO updateUtilisateurDAO
    GRAVE: Updating Utilisateur failed
    org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.thales.project.Statut
    	at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219)
    	at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397)
    	at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:78)
    	at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1997)
    ceci etant, est ce normal qu'elle soit mis a session
    alors que moi, j'en ai juste besoin lors de la soumission du form , y a pas d'impact derrieres? pour le reste du dev

    Merci !
    Sallemel

  8. #8
    Expert confirmé

    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
    Par défaut
    En fait, dans ton cas, la requête commence à l'appel de l'Action qui initialise le formulaire.
    Quand la jsp s'affiche, la réponse a été construite et envoyée au navigateur, ce qui signifie que la requête est terminée.
    Si le form-bean est en scope request, au submit du formulaire, une nouvelle requête est envoyée et donc la List users est réinitialisée.
    Ceci explique pourquoi il faut utiliser le scope session.

    Toutefois, il existe une solution avec le scope du form-bean à request mais pour cela, il faut utiliser les propriétés indexées et le principe des Lazy List pour reconstruire la List d'objets Utilisateur au submit du formulaire.

    Concrètement, il faudrait utiliser le tag logic:iterate et les tags html:text avec l'attribut indexed="true", ajouter getter et setter indexé sur l'objet Utilisateur dans l'ActionForm avec reconstruction de la liste dans le getter.

    Soit par exemple dans la jsp :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <logic:iterate name="userEditForm" property="users" id="user">
       <html:text name="user" property="userNom" indexed="true"/>
       <html:text name="user" property="userPrenom" indexed="true"/>
       <html:text name="user" property="userIdentifiant" indexed="true"/>
    </logic:iterate>
    et dans l'ActionForm :
    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
          public List getUsers() {
              return this.users ;
          }
          public void setUsers(List Users) {
              this.users=users ;
          }
          public void setUser(int i,Utilisateur user) {
              this.users.set(i,user) ;
          }
          public Utilisateur getUser(int index) {
              while (index >= this.users.size())
              {
                  this.users.add(new Utilisateur());
              }
              return (Utilisateur) this.users.get(index);
          }
    Sinon, concernant l'erreur Hibernate, je ne vais malheureusement pas pouvoir t'aider.

  9. #9
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 313
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Billets dans le blog
    1
    Par défaut
    L'erreur Hibernate est assez claire en soit, tu références une instance d'entité (com.thales.project.Statut je suppose) non sauvegardée (transient).
    Il faudrait soit persister l'instance fille avant de persister l'instance de l'objet qui la référence, soit modifier le mapping pour que le moteur le fasse lui même (attribut cascade)

    A+
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  10. #10
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut
    Salut ,
    merci pour les reponses , sinon
    bon voila ce qu'il en est :
    - pour le probleme hibernate, si j'ajoute l'attribut cascade, il va modifier
    au niveau de la table statut, compose de colonnes id, libelle
    or ces valeurs sont fixe, a moins que ulterieurement on ajoute un nouveau etat
    mais pour la manip cote user, le changement de statut se fera uniquement sur l'utilisateur, pas sur la table statut.
    -le problement mnt, c'est autre, d'ailleurs je ne lui trouve pas une explication :
    l'affichage ... se deroule bien
    l'edition de chaque entree : passage de nested:write a nested:text est ok
    a un element pres
    en fait , pour le premier row , tout est nickel, modification
    des champs string, des champs nested, statut et profil
    le probleme
    est pour les row intermidiares, entre le premier et derniers elements
    le changement de statut ne se fait jamais au niveau de la base , bizarre

    parfois, a part le chagement du mode : edition ou visualisation
    toutes les modifs sont ignorees
    alors la question pourquoi la recuperation et sauvegarde des modifs reussissent bien pour le premier element et pas pour les autres

    voici le code html genere

    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
     
    		<form name="userEditForm" method="post" action="/FirstProject/EditUsers.do?do=ListUsers">
     
    <tr>
    <td
    style="width: 615px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 24px;">
    	&nbsp; <span style="font-size: 10pt"> <input type="text" name="users[0].userNom" value="sallemdddfff" style="width: 132px"></span></td>
    <td
    style="width: 23004px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: left;">
    <span style="font-size: 10pt"> <input type="text" name="users[0].userPrenom" value="elyes197777ddii" style="width: 127px"></span></td>
    <td
    style="width: 9113px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> <input type="text" name="users[0].userIdentifiant" maxlength="8" value="sallemed" style="width: 63px"></span></td>
    <td
    style="width: 10320px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> <input type="text" name="users[0].userPwd" maxlength="8" value="sallem" style="width: 63px"></span></td>
    <td
    style="width: 15787px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> 
     
    	<select name="users[0].profil.profilId"><option value="2" selected="selected">Consultation</option>
    <option value="1">Administrateur</option>
    <option value="3">Modification</option></select>
    </span></td>
    <td
    style="border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; width: 4299px; border-bottom: #f0f8ff 1px solid; height: 26px; background-color: #f0f8ff">
    <span style="font-size: 10pt">
     
    	<select name="users[0].statut.statutId"><option value="1" selected="selected">ACTIF</option>
    <option value="0">INACTIF</option></select>
     
     
    	 </span></td>
    <td
    style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    	&nbsp; 
    	<input type="submit" name="users[0].updateUserButton" value="valider">
    </td>
     
    </tr>
     
    <tr>
    <td
    style="width: 615px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 24px;">
    	&nbsp; <span style="font-size: 10pt"> <input type="text" name="users[1].userNom" value="sallem" style="width: 132px"></span></td>
    <td
    style="width: 23004px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: left;">
    <span style="font-size: 10pt"> <input type="text" name="users[1].userPrenom" value="rached44" style="width: 127px"></span></td>
    <td
    style="width: 9113px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> <input type="text" name="users[1].userIdentifiant" maxlength="8" value="rached" style="width: 63px"></span></td>
    <td
    style="width: 10320px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> <input type="text" name="users[1].userPwd" maxlength="8" value="rached" style="width: 63px"></span></td>
    <td
    style="width: 15787px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> 
     
    	<select name="users[1].profil.profilId"><option value="2" selected="selected">Consultation</option>
    <option value="1">Administrateur</option>
    <option value="3">Modification</option></select>
     
     
    </span></td>
    <td
    style="border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; width: 4299px; border-bottom: #f0f8ff 1px solid; height: 26px; background-color: #f0f8ff">
    <span style="font-size: 10pt">
     
    	<select name="users[1].statut.statutId"><option value="1" selected="selected">ACTIF</option>
    <option value="0">INACTIF</option></select>
     
    	 </span></td>
    <td
    style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    	&nbsp; 
    	<input type="submit" name="users[1].updateUserButton" value="valider">
    </td>
     
    </tr>
     
    <tr>
     
     
     
    <td
    style="width: 615px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 24px;">
    	&nbsp; <span style="font-size: 10pt"> <input type="text" name="users[2].userNom" value="guy188pp" style="width: 132px"></span></td>
    <td
    style="width: 23004px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: left;">
    <span style="font-size: 10pt"> <input type="text" name="users[2].userPrenom" value="bernard88p" style="width: 127px"></span></td>
    <td
    style="width: 9113px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> <input type="text" name="users[2].userIdentifiant" maxlength="8" value="guyb" style="width: 63px"></span></td>
    <td
    style="width: 10320px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> <input type="text" name="users[2].userPwd" maxlength="8" value="bernard" style="width: 63px"></span></td>
    <td
    style="width: 15787px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    <span style="font-size: 10pt"> 
     
    	<select name="users[2].profil.profilId"><option value="2">Consultation</option>
    <option value="1" selected="selected">Administrateur</option>
    <option value="3">Modification</option></select>
     
     
    </span></td>
    <td
    style="border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; width: 4299px; border-bottom: #f0f8ff 1px solid; height: 26px; background-color: #f0f8ff">
    <span style="font-size: 10pt">
     
    	<select name="users[2].statut.statutId"><option value="1" selected="selected">ACTIF</option>
    <option value="0">INACTIF</option></select>
     
     
    	 </span></td>
    <td
    style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    	&nbsp; 
    	<input type="submit" name="users[2].updateUserButton" value="valider">
    </td>
     
    </tr>
     
    </form>


    A+
    Sallemel

  11. #11
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 313
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Billets dans le blog
    1
    Par défaut
    Peux-tu mettre le code de la page ?
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  12. #12
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut
    voici le page 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
    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
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
     
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    	pageEncoding="ISO-8859-1"%>
     
    <%@ taglib uri="/tags/struts-logic" prefix="logic"%>
    <%@ taglib uri="/tags/struts-bean" prefix="bean"%>
    <%@ taglib uri="/tags/struts-html" prefix="html"%>
    <%@ taglib uri="/tags/struts-nested" prefix="nested"%>
     
     
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>CPFA - Gestion des Utilisateurs</title>
    <script type="text/javascript" language="javascript"
    	src="Javascript\menu.js"></script>
    <script type="text/javascript" language="javascript"
    	src="Javascript\config.js"></script>
    <script type="text/javascript" language="javascript"
    	src="Javascript\data.js"></script>
    <link href="css\valeo.css" rel="stylesheet" type="text/css">
    </head>
    <body style="text-align: right">
    <script language="javascript"> 
    <!--     
    function champsok()     
    {
    if (document.forms[0].elements["userIdentifiant"].value.length == 0)
     {
     alert("Le champs Identifiant ne doit pas etre vide.");
      document.forms[0].elements["userIdentifiant"].focus()
     return false;
     }
     else if(document.forms[0].elements["userPwd"].value.length ==0 )
    {
     alert("Le champs mot de passe ne doit pas etre vide.");
     document.forms[0].elements["userPwd"].focus()
     return false;
     }
      return true;
      }
     -->
    </script>
     
    <table cellpadding="0" cellspacing="0" width="100%" border=1
    	bordercolor="#3B72A5">
    	<tr bgcolor="#FFFFFF">
    		<td height=1 valign=middle><img src="img\FondMenuHaut.jpg"
    			vspace=0 style="width: 900px"></td>
    	</tr>
    	<tr>
    		<td bgcolor="#508ECC" valign="bottom" style="text-align: left"><script
    			type="text/javascript">
                var isHorizontal=1;
                var fontColor=["#FFFFFF","#FFFFFF"];
    			var itemBackColor=["#508ECC","#3B72A5"];
    			var itemBorderColor=["#508ECC","#508ECC"];
    			var fontStyle="8pt Arial bold";
    			var menuBackColor="#508ECC";
    			var menuBorderColor="#508ECC";
                MenuDyn_init();
            </script></td>
    	</tr>
    	<tr>
    		<td style="text-align: center">
    		<table width="100%">
    			<tr>
    				<td style="height: 27px; text-align: center" colspan="3"><strong><span
    					style="color: #330099"><span style="color: #508ECC">
    				<span style="font-size: 14pt"> <br />
    				<span style="font-size: 12pt; color: #000099;"> CPFA -
    				Gestion des Utilisateurs</span></span></span></span></strong></td>
    			</tr>
    		</table>
     
    		<table border="0" cellpadding="0" cellspacing="0"
    			style="border-right: #508ECC 1px solid; border-top: #508ECC 1px solid; border-left: #508ECC 1px solid; border-bottom: #508ECC 1px solid">
    			<tr>
    				<td
    					style="border-right: #508ECC 1px solid; border-top: #508ECC 1px solid; border-left: #508ECC 1px solid; width: 9543px; border-bottom: #508ECC 1px solid; height: 24px; background-color: #508ECC; text-align: left;">
    				<span style="font-size: 10pt; color: #ffffff"><strong>Nom</strong></span></td>
    				<td
    					style="border-right: #508ECC 1px solid; border-top: #508ECC 1px solid; border-left: #508ECC 1px solid; width: 23004px; border-bottom: #508ECC 1px solid; height: 24px; background-color: #508ECC; text-align: left;">
    				<span style="font-size: 10pt; color: #ffffff"><strong>Prénom</strong></span></td>
    				<td
    					style="border-right: #508ECC 1px solid; border-top: #508ECC 1px solid; border-left: #508ECC 1px solid; width: 9113px; border-bottom: #508ECC 1px solid; height: 24px; background-color: #508ECC; text-align: center;">
    				<strong><span style="font-size: 10pt; color: #ffffff">Identifiant</span></strong></td>
    				<td
    					style="border-right: #508ECC 1px solid; border-top: #508ECC 1px solid; border-left: #508ECC 1px solid; width: 10320px; border-bottom: #508ECC 1px solid; height: 24px; background-color: #508ECC; text-align: center;">
    				<span style="font-size: 10pt; color: #ffffff"><strong>Mot
    				de passe</strong></span></td>
    				<td
    					style="border-right: #508ECC 1px solid; border-top: #508ECC 1px solid; border-left: #508ECC 1px solid; width: 15787px; border-bottom: #508ECC 1px solid; height: 24px; background-color: #508ECC; text-align: center;">
    				<span style="font-size: 10pt; color: #ffffff"><strong>Profil</strong></span></td>
    				<td
    					style="border-right: #508ECC 1px solid; border-top: #508ECC 1px solid; border-left: #508ECC 1px solid; width: 4299px; border-bottom: #508ECC 1px solid; height: 24px; background-color: #508ECC">
    				<strong><span style="font-size: 10pt; color: #ffffff">Statut</span></strong></td>
    				<td
    					style="border-right: #508ECC 1px solid; border-top: #508ECC 1px solid; border-left: #508ECC 1px solid; width: 299px; border-bottom: #508ECC 1px solid; height: 24px; background-color: #508ECC">
    				&nbsp;</td>
    			</tr>
    			<logic:empty property="users" name="userEditForm">
    			<tr>
    				<td colspan="5">No users available</td>
    			</tr>
    		</logic:empty>
    		<logic:notEmpty property="users" name="userEditForm" >
    		<nested:form action="EditUsers.do?do=ListUsers">
    			<nested:iterate  property="users">
    																	<tr>
    					<nested:equal property="userEditMode" value="0">
     
    						<td
    							style="width: 9543px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: left; height: 24px;">
    						<span style="font-size: 10pt"><nested:write property="userNom" /></span></td>
    						<td
    							style="width: 23004px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: left; height: 24px;">
    						<span style="font-size: 10pt"><nested:write property="userPrenom" /></span></td>
    						<td
    							style="width: 9113px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: center; height: 24px;">
    						<span style="font-size: 10pt"><nested:write property="userIdentifiant" /></span></td>
    						<td
    							style="width: 10320px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; text-align: center; height: 24px;">
    						<span style="font-size: 10pt"><nested:write 						property="userPwd" /></span></td>
    						<td
    							style="width: 15787px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px; text-align: center;">
    						<span style="font-size: 10pt"></span> 
    							<nested:nest property="profil">
    								<nested:write property="profilLabel" />
    							</nested:nest>
    						</td>
    						<td
    							style="border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; width: 4299px; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px; text-align: center;">
    						<span style="font-size: 10pt">
    							<nested:nest property="statut">
    								<nested:write property="statutLabel" />
    							</nested:nest>
    						</span></td>
     
    						<td
    							style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    						&nbsp;<nested:submit property="editUserButton" >modifier</nested:submit></td>
     
    					</nested:equal>
    					<nested:notEqual  property="userEditMode" value="0">
     
    						<td
    							style="width: 615px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px;">
    						&nbsp; <span style="font-size: 10pt"> <nested:text
    							property="userNom" style="width: 132px"  /></span></td>
    						<td
    							style="width: 23004px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: left;">
    						<span style="font-size: 10pt"> <nested:text 
    							style="width: 127px"  property="userPrenom" /></span></td>
    						<td
    							style="width: 9113px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    						<span style="font-size: 10pt"> <nested:text
    							style="width: 63px" property="userIdentifiant" maxlength="8" /></span></td>
    						<td
    							style="width: 10320px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    						<span style="font-size: 10pt"> <nested:text
    							style="width: 63px" property="userPwd" maxlength="8"/></span></td>
    						<td
    							style="width: 15787px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    						<span style="font-size: 10pt"> 
    							<nested:nest property="profil">
    								<nested:select property="profilId">
    									<nested:optionsCollection name="userEditForm"
    										property="profilsList" value="profilId" label="profilLabel" />
    								</nested:select>
    								</nested:nest>
     
    						</span></td>
    						<td
    							style="border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; width: 4299px; border-bottom: #f0f8ff 1px solid; height: 26px; background-color: #f0f8ff">
    						<span style="font-size: 10pt">
    						<nested:nest property="statut"> 
    															<nested:select property="statutId">
    									<nested:optionsCollection name="userEditForm"
    										property="statutsList" value="statutId" label="statutLabel" />
    								</nested:select>
    								</nested:nest>
     
    						 </span></td>
    						<td
    							style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    						&nbsp; 
    						<nested:submit property="updateUserButton" >valider</nested:submit>
    						</td>
    					</nested:notEqual>
    				</tr>
    				</nested:iterate>
    				</nested:form>
    			</logic:notEmpty>
    			<tr>
    				<html:form action="EditUsers.do?do=addUser" onsubmit="return champsok()">
     
    					<td
    						style="width: 615px; border-right: #d8e4f8 1px solid; border-top: #d8e4f8 1px solid; border-left: #d8e4f8 1px solid; border-bottom: #d8e4f8 1px solid; background-color: #d8e4f8; height: 24px;">
    					<span style="font-size: 10pt"> <nested:text 
    						property="userNom" style="width: 132px" /></span></td>
    					<td
    						style="width: 23004px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: left;">
    					<span style="font-size: 10pt"> <nested:text
    						style="width: 127px"  property="userPrenom" /></span></td>
    					<td
    						style="width: 9113px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    					<span style="font-size: 10pt"> <nested:text
    						style="width: 63px"  property="userIdentifiant"
    						/></span></td>
    					<td
    						style="width: 10320px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    					<span style="font-size: 10pt"> <nested:text
    						style="width: 63px" property="userPwd" /></span></td>
     
    					<td
    						style="width: 15787px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px; text-align: center;">
    					<span style="font-size: 10pt"> </span>
     
    						<nested:nest property="profil">	
    						<nested:select property="profilId" >
    								<nested:optionsCollection name="userEditForm"
    									property="profilsList" value="profilId" label="profilLabel" />
    							</nested:select>
    							</nested:nest>
     
    																</td>
     
    					<td
    						style="border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; width: 4299px; border-bottom: #f0f8ff 1px solid; height: 26px; background-color: #f0f8ff">
    					<span style="font-size: 10pt"> 
    					<nested:nest property="statut">
    						<nested:select property="statutId" >
    								<nested:optionsCollection name="userEditForm"
    									property="statutsList" value="statutId" label="statutLabel" />
    							</nested:select>
    							</nested:nest>
     
    					 </span></td>
    					 										<td
    						style="width: 7098px; border-right: #f0f8ff 1px solid; border-top: #f0f8ff 1px solid; border-left: #f0f8ff 1px solid; border-bottom: #f0f8ff 1px solid; background-color: #f0f8ff; height: 26px;">
    					&nbsp;<nested:submit>ajouter</nested:submit></td>
    					<nested:hidden property="userEditMode" value="0" />
     
    				</html:form>
    			</tr>
     
    		</table>
     
    	</tr>
     
    </table>
    </body>
    </HTML>
    et ici les methodes setter associes au bouton update et edit

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    	 public void setUpdateUserButton(String empty) {
    		    this.setUserEditMode(new Integer(0));
    		    HibernateUtilisateurDAO dao=new HibernateUtilisateurDAO();
    		    dao.updateUtilisateurDAO(this);
    		  }
    		 public void setEditUserButton(String empty) {
    		    this.setUserEditMode(new Integer(5));
    		    HibernateUtilisateurDAO dao=new HibernateUtilisateurDAO();
    		    dao.updateUtilisateurDAO(this);
    		  }
    fichier de configuration du user :
    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
     
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- Generated 5 nov. 2008 15:57:01 by Hibernate Tools 3.2.0.CR1 -->
    <hibernate-mapping>
        <class name="com.thales.project.Utilisateur" table="UTILISATEUR" lazy="false">
            <id name="userId" type="int">
                <column name="USER_ID" precision="7" scale="0" />
                <generator class="increment" />
            </id>
            <many-to-one name="profil" class="com.thales.project.Profil" fetch="select">
                <column name="USER_PROFIL" precision="7" scale="0" not-null="true" />
            </many-to-one>
            <many-to-one name="statut" class="com.thales.project.Statut" fetch="select">
                <column name="USER_STATUT" precision="7" scale="0" not-null="true" />
            </many-to-one>
            <property name="userNom" type="string">
                <column name="USER_NOM" length="100" not-null="true" />
            </property>
            <property name="userPrenom" type="string">
                <column name="USER_PRENOM" length="100" not-null="true" />
            </property>
            <property name="userIdentifiant" type="string">
                <column name="USER_IDENTIFIANT" length="8" not-null="true" />
            </property>
            <property name="userPwd" type="string">
                <column name="USER_PWD" length="8" not-null="true" />
            </property>
            <property name="userEditMode" type="int">
                <column name="USER_EDIT_MODE" precision="7" scale="0" not-null="true" />
            </property>
            <set name="dataMonitorings" inverse="true">
                <key>
                    <column name="USER_ID" precision="7" scale="0" not-null="true" />
                </key>
                <one-to-many class="com.thales.project.DataMonitoring" />
            </set>
        </class>
    </hibernate-mapping>
    A+
    Sallemel

  13. #13
    Expert confirmé

    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
    Par défaut
    Il y a un code qui me chiffonne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    	public void setUsers(Object [] usersParam) {
    		JOptionPane.showMessageDialog(null, "size="+usersParam.length);
    		this.users = new ArrayList<Utilisateur>();
    		    for (int i = 0; i < usersParam.length; i++) {
    		    	this.users.add((Utilisateur)usersParam[i]);
    		    }
    	}
    JOptionPane, ce n'est pas un composant SWING ?
    Et cette méthode setUsers là, elle fonctionne ?
    C'est elle que tu exécutes pour constituer la List de users ?

    Si c'est bien le cas, pourrais-tu montrer comment tu constitues le tableau d'objets usersParam ?
    Sinon, peux-tu montrer comment tu constitues la List users ?

  14. #14
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut
    oui t'as tout a fait raison, mais vu que .. shui bon en debug des jsp ...
    pour la liste des users, pas de probleme, il m'affiche toujours la liste des users
    plus que ca , la modif du premier row , passe toujours et
    la modifs du dernier row passe , sauf pour l'element statut, pourtant c'est la meme logique de dev que profil
    sinon, voici la recuperation des users :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    public Object[] getUsers() {
    		return this.users.toArray();
    	}
    A+
    Sallemel

  15. #15
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut
    ce qui est hallucinant
    c'est que , en essayant avec 5 users au niveau de la base
    les modifs pour les champs "simples" passe pour 4 rows
    la modif du profil passe pour le premier row et le dernier
    la modif du statut passe uniquement pour le premier row
    et le passage en mode edition et visualisation passe pour tous les rows !!

  16. #16
    Expert confirmé

    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
    Par défaut
    Citation Envoyé par c_nvy Voir le message
    Si c'est bien le cas, pourrais-tu montrer comment tu constitues le tableau d'objets usersParam ?

  17. #17
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut
    c'est dans l'action que je la construit, la voici
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
     
    	public ActionForward ListUsers(ActionMapping mapping, ActionForm form,
    			HttpServletRequest request, HttpServletResponse response) throws Exception{
     
    		HibernateUtilisateurDAO dao = new HibernateUtilisateurDAO();
    		List<Utilisateur> users = dao.listUtilisateurDAO();
    		UserEditForm userEditFrom = (UserEditForm) form;
     
    			userEditFrom.setUsers(users.toArray());
    			return mapping.findForward("gererUsers");
     
     
    	}

  18. #18
    Expert confirmé

    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
    Par défaut
    Je n'utilise pas Hibernate mais je sais que tu peux directement récupérer une List d'objets Utilisateur en utilisant createQuery :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    return session.createQuery("from Utilisateur").list();
    et tu peux directement utiliser cette List sans avoir à coder un users.toArray().

    Peux-tu modifier ta requête et ton code en conséquence pour voir si ça fonctionne mieux ?

  19. #19
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    190
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2008
    Messages : 190
    Par défaut
    Bonjour c_nvy,
    le probleme n'est pas lors de la recuperation des donnees de la base
    pour l'affichage , tout est ok, il me recupere la liste des entrees
    avec les bonnes donnees
    c'est lors de la soumission, lors du populate
    il y a des infos qui se perdent
    d'ailleurs, en faisant le test sur plusieurs cas
    pour la meme modif, parfois ca passe , parfois non?
    d'ou la question a quoi est du cette perte des donnees?
    y a t-il un truc que j'ai du oublie, dans le form, la jsp ?

  20. #20
    Expert confirmé

    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
    Par défaut
    J'ai bien compris mais si ta liste a été mal constituée, tu peux avoir quelque chose qui s'affiche bien mais quand tu veux la modifier, ça fait n'importe quoi.

    Un cas typique d'erreur déjà rencontré c'est que parfois, lors de la constitution de la collection d'objets, on oublie de créer une nouvelle instance d'objet à chaque itération et dans ce cas, la mise à jour ne fait pas du tout ce que l'on souhaite.

Discussions similaires

  1. lien hypertexte html link et param
    Par DonKnacki dans le forum Struts 1
    Réponses: 1
    Dernier message: 09/03/2010, 09h22
  2. html:text dans un logic:iterate
    Par ptitom1381 dans le forum Struts 1
    Réponses: 4
    Dernier message: 07/11/2008, 13h11
  3. <html:errors/> dans des <logic:iterate>
    Par BugFactory dans le forum Struts 1
    Réponses: 6
    Dernier message: 22/07/2008, 19h13
  4. lien (page html) s'ouvrant dans la même fenêtre
    Par hicham_alaoui1 dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 15/09/2007, 19h22
  5. Réponses: 31
    Dernier message: 27/07/2006, 13h51

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