Bonjour,
je suis en train de développer une application en J2EE, struts et hibernate.
je suis bloqué sur un problème de modification de ligne, j'affiche une table et dans chaque ligne de cette table j'ai deux butons le premier pour valider la demande (ça permet de passer le statue demande à validé) et le deuxième pour refuser' le statue passe a refusé).
mais ça marche que pour la premier ligne et quand je fais la même opération pour les autres lignes j'ai l'erreur :
pourtant quand j'ai regarde le code source de la page j'ai bien un form pour chaque ligne donc je vois pas pourquoi j'arrive pas à faire ce que je veux
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 java.lang.NoSuchMethodException: gestion.conge.gestionconge.ui.usersAction.actions.AfficherDemandeEnvoyeParEmployeManageAction.(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) java.lang.Class.getMethod(Unknown Source) org.apache.struts.actions.DispatchAction.getMethod(DispatchAction.java:322) org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:262) org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) gestion.conge.gestionconge.ui.HibernateFilter.doFilter(HibernateFilter.java:35)
voici mon code jsp:
et mon code java
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 <html:html> <head> <title><bean:message key="listeDemandeConge"/></title> </head> <body> <table border="1"> <thead> <tr> <th><bean:message key="numero_demande"/></th> <th><bean:message key="date_demande_conge"/></th> <th><bean:message key="date_depart"/></th> <th><bean:message key="date_fin"/></th> <th><bean:message key="reponse_conge"/></th> <th><bean:message key="nb_jour_conge"/></th> </tr> </thead> <tbody> <logic:iterate id="elementDemande" name="demande3" type="gestion.conge.gestionconge.business.conge.DemandeConge"> <html:form action="AfficherDemandeEnvoyeParEmployeManageAction" method="POST"> <html:hidden property="event" value=""/> <tr> <td><bean:write name="elementDemande" property="idDemandeConge"/></td> <html:hidden property="id" value= "<%=elementDemande.getId()%>" /> <td><bean:write name="elementDemande" property="dateDemandeCongeFormatee"/></td> <td><bean:write name="elementDemande" property="dateDepartFormatee"/></td> <td><bean:write name="elementDemande" property="dateFinFormatee"/></td> <td><bean:write name="elementDemande" property="reponseConge"/></td> <td><bean:write name="elementDemande" property="nbJourConge"/></td> <th> <html:submit property="validerDemande" value="valider" onclick="valider()"/> </th> <th> <html:submit property="validerDemande" value="refuser" onclick="refuser()"/> </th> </tr> </html:form> </logic:iterate> </tbody> </table> </body> <script language=javascript> function valider() { var p = confirm('Etes vous sur de vouloir supprimer votre demande de conge ? Cette opération est irréversible ?') if(p == true) AfficherDemandeEnvoyeParEmployeManageForm.event.value = 'validerDemande' } function refuser() { var p = confirm('Etes vous sur de vouloir supprimer votre demande de conge ? Cette opération est irréversible ?') if(p == true) AfficherDemandeEnvoyeParEmployeManageForm.event.value = 'refuserDemande' } </script> <html:link href="CongeManagerAction.do?event=init">retour vers la page demande conge</html:link> </html:html>
je pense qu'il récupère mal l'id mais je ne vois pas comment faire pour corriger ça.
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 /** * Process the specified HTTP request for <strong>validerDemande</strong> event. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception Exception if an input/output error or servlet exception occurs */ public ActionForward validerDemande(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { log.debug("Starting"); String returnCode = PAGE_SELF; AfficherDemandeEnvoyeParEmployeManageForm afficherDemandeEnvoyeParEmployeManageForm = (AfficherDemandeEnvoyeParEmployeManageForm)form; //Start of user code method validerDemande List<DemandeConge> demande3 = new ArrayList<DemandeConge>(); Employe employe = (Employe)request.getSession().getAttribute(gestion.conge.gestionconge.ui.UiConstants.CURRENT_USER); IDemandeCongeDao dao = GestioncongeDaoFactory.getDemandeCongeDao(); IEmployeDao dao1 = GestioncongeDaoFactory.getEmployeDao(); String id= request.getParameter("id"); //demande1 = dao.findDemandeAnnulationByDateDepartEtDateFin(employe); DemandeConge demandeValide = new DemandeConge(); demandeValide = dao.findDemandeCongeById(id); demandeValide.setReponseConge("demande validé"); dao.updateDemandeConge(demandeValide); returnCode = PAGE_SUCCESSVALIDATION ; //End of user code return mapping.findForward(returnCode); } /** * Process the specified HTTP request for <strong>refuserDemande</strong> event. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception Exception if an input/output error or servlet exception occurs */ public ActionForward refuserDemande(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { log.debug("Starting"); String returnCode = PAGE_SELF; AfficherDemandeEnvoyeParEmployeManageForm afficherDemandeEnvoyeParEmployeManageForm = (AfficherDemandeEnvoyeParEmployeManageForm)form; //Start of user code method refuserDemande List<DemandeConge> demande3 = new ArrayList<DemandeConge>(); Employe employe = (Employe)request.getSession().getAttribute(gestion.conge.gestionconge.ui.UiConstants.CURRENT_USER); IDemandeCongeDao dao = GestioncongeDaoFactory.getDemandeCongeDao(); IEmployeDao dao1 = GestioncongeDaoFactory.getEmployeDao(); String id= request.getParameter("id"); DemandeConge demandeValide = new DemandeConge(); demandeValide = dao.findDemandeCongeById(id); demandeValide.setReponseConge("demande refusé"); dao.updateDemandeConge(demandeValide); returnCode = PAGE_SUCCESSREFUS ; //End of user code return mapping.findForward(returnCode); }
merci d'avance.
Cordialement,
Partager