Bonjour,
J’ai un petit problème sur un appel de fonction l’erreur est :
cannot find symbol
method rechercheVehiculeParMarque(java.lang.String)
class RechercheVehiculeParMarqueAction
pour la ligne :rechercheVehiculeParMarque(saisie); => présent public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception
voici le code complet de la page
/*
* RechercheVehiculeParMarqueAction.java
*
* Created on 18 avril 2007, 19:01
*/
import java.sql.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import java.util.ArrayList;
import javax.sql.*;
import org.apache.struts.Globals;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.DriverManager;
/**
*
* @author Florent
* @version
*/
public class RechercheVehiculeParMarqueAction extends Action {
/* forward name="success" path="" */
private final static String SUCCESS = "sucess";
/**
* This is the action called from the Struts framework.
* @param mapping The ActionMapping used to select this instance.
* @param form The optional ActionForm bean for this request.
* @param request The HTTP Request we are processing.
* @param response The HTTP Response we are processing.
* @throws java.lang.Exception
* @return
*/
// permet de réenvoyer le contenu du résultat a la page résultat
public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception
{
RechercheVehiculeParMarque Form = (RechercheVehiculeParMarque)form;
String saisie = Form.getSaisie();
rechercheVehiculeParMarque(saisie);
return mapping.findForward(SUCCESS);
}
private ArrayList rechercherVehiculeParMarque(String saisie) throws ClassNotFoundException, SQLException
{
String MODELE = null,COULEUR = null;
int PRIX;
ResultSet resultat = null;
ArrayList liste = new ArrayList();
Class.forName("org.apache.derby.jdbc.ClientDriver");
Connection conn =DriverManager.getConnection("jdbc:derby://localhost:1527/Application", "nfe114", "nfe114");
Statement statement = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
String sql = "select * FROM \"NFE114\".\"VEHICULE\" WHERE MARQUE='"+saisie+"'";
System.out.println("select * FROM \"NFE114\".\"VEHICULE\" WHERE MARQUE='"+saisie+"'");
resultat = statement.executeQuery(sql);
while(resultat.next())
{
int ID = resultat.getInt(1);
String MARQUE = resultat.getString(2);
PRIX = resultat.getInt(3);
java.sql.Date date = resultat.getDate(4);
int row = resultat.getRow();
System.out.println(saisie);
System.out.println("Données contenues dans la ligne "+row);
System.out.println("id : "+ID+" marque : "+MARQUE+" prix : "+PRIX+" modele : "+MODELE+" couleur : "+COULEUR+" <html:link href=panier.do?id='"+ID+"'>Panier</>");
//objet= "id : "+ID+" marque : "+MARQUE+" prix : "+PRIX+" modele : "+MODELE+" couleur : "+COULEUR+" <html:link href=panier.do?id='"+ID+"'>Panier</>";
liste.add(new RechercheVehiculeParMarque(resultat.getInt(1), resultat.getString(2)));
}
return liste;
}
}
merci d’avance
Edité le 03/06/2007 à 12:43