salut tt le monde, j'ai un ptit pb voilà ma page JSP dans lakelle je fais une recherche selon un attribut "id_site_los" ki figure dans ma table site_los_resultat dans ma base de donnée, cette table à pour ID "id_site";
quand j'entre par exemple dans le champs "Rechercher par site" la valeur "CAS0012" que j'ai dans la table, j'ai l'erreur 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 <%@ page language="java"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html:html locale="true"> <head> <link rel="stylesheet" type="text/css" href="css/style.css" /> <html:base /> <title>Voulez Vous:</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <div id="body_wrapper"> <div id="body"> <div id="all"> <div class="top"></div> <div class="content"> <html:link action="viewSites.do?do=showSites">Afficher tous les Sites:</html:link> <html:form action="viewSites.do?do=showSitesById" method="GET"> <table border="0" align="center" width="50%" height="50%"> <tr> <td>Rechercher par Site: <td/> <td><html:text property="id_site_los" size="8" value=""/><html:errors property="id_site_los"/><br/><td/> <tr/> <tr> <td colspan="1"> <html:submit>GO</html:submit> </td> </tr> </table> </html:form> </body> </html:html>
bon l'action définie dans struts-config.xml est:type Rapport d'état
message Request[/viewSites] does not contain handler parameter named do
description La requête envoyée par le client était syntaxiquement incorrecte (Request[/viewSites] does not contain handler parameter named do).
et la classe java dans le package ..struts.action est SitesListAction:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 <action attribute="siteLosResultatForm" name="siteLosResultatForm" parameter="do" path="/viewSites" input="/form/siteEdit.jsp" scope="request" type="com.monpfe.struts.action.SitesListAction" > <forward name="showList" path="/form/sitesList.jsp" /> <forward name="showListAfterDelete" path="/viewSites.do?do=showSites" /> <forward name="showListAfterDeleteId" path="/viewSites.do?do=showSitesById" /> </action>
par ailleurs la classe java où se trouve la méthode findByIdLos(String id_site_los){...}
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 package com.monpfe.struts.action; import java.util.Collection; 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.DispatchAction; import com.monpfe.metier.SiteLosResultat; import com.monpfe.struts.form.SiteLosResultatForm; public class SitesListAction extends DispatchAction { public ActionForward showSites( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { SiteLosResultatForm siteLosResultatForm=(SiteLosResultatForm) form; SiteLosResultat site=new SiteLosResultat(); Collection c; try { c = (Collection) site.Lister(); siteLosResultatForm.setSites(c); }catch (Exception e) { e.printStackTrace(); } return mapping.findForward("showList"); } public ActionForward deleteSite( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { SiteLosResultatForm siteLosResultatForm=(SiteLosResultatForm) form; Long id_site =Long.parseLong(request.getParameter("id_site")); SiteLosResultat site=new SiteLosResultat(); site.deleteById(id_site); return mapping.findForward("showListAfterDelete"); } public ActionForward showSitesById( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { SiteLosResultatForm siteLosResultatForm=(SiteLosResultatForm) form; String id_site_los =request.getParameter("id_site_los"); //Long Id =Long.parseLong(request.getParameter("Id")); SiteLosResultat site=new SiteLosResultat(); Collection c; try{ c=(Collection) site.findByIdLos(id_site_los); siteLosResultatForm.setSites(c); }catch(Exception e){ e.printStackTrace(); } return mapping.findForward("showList"); } }
merci infiniment de m'aider la dessus!
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 ... public SiteLosResultatBean findByIdLos(String id_site_los) { Sql sql=new Sql(); ArrayList liste=null; String message="select * from site_los_resultat where id_site_los= '" + id_site_los+"'"; ResultSet rst=sql.list(message); liste = new ArrayList(); SiteLosResultatBean ligne=null; try{ while(rst.next()) { ligne=new SiteLosResultatBean(); ligne.setId_site(rst.getInt("id_site")); ligne.setId_site_los(rst.getString("id_site_los")); ligne.setCandidat_los(rst.getString("candidat_los")); ligne.setLongitude_los(rst.getString("longitude_los")); ligne.setLatitude_los(rst.getString("latitude_los")); ligne.setAdresse_los(rst.getString("adresse_los")); ligne.setH_los(rst.getInt("h_los")); ligne.setComment_los(rst.getString("comment_los")); ligne.setState_acquisition(rst.getString("state_acquisition")); ligne.setDate_saisie(rst.getString("date_saisie")); liste.add(ligne); } }catch(SQLException e){ System.out.println("erreur rst.next : "+e.getMessage()); } sql.fermerConnection(); return ligne; }...
je suis bloké devant le pc en attendant vos suggestions!
Partager