Bonjour a tous !
Mon problème est que dans une classe j'utilise un package que j'ai moi-même créé mais elle ne le trouve pas et je ne comprend pas pourquoi
L'erreur donnée est :
Je ne pense pas que ca soit difficile mais ca fait un petit moment que je suis dessus et je n'y arrive pas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 AdminEntree.java:8: package org does not exist import org.Entree;
Alors j'ai la classe AdminEntree (celle avec le "import") :
Et ma classe Entree :
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 package servlet; import java.util.ArrayList; import java.util.Collection; import javax.servlet.ServletException; import org.Entree; public class AdminEntree extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet{ public void init() throws ServletException { super.init(); Collection collection = new ArrayList(); Entree entree = new Entree("Dupont","Robert","00 00 00 00 00","dupont@free.fr"); collection.add(entree); collection.add(new Entree("Durant","Jules","11 11 11 11 11","durant@free.fr")); collection.add(new Entree("Martin","Gerard","22 22 22 22 22","martin@free.fr")); // Ajoute la collection au contexte de l'application // avec pour nom agenda getServletContext().setAttribute("agenda",collection); } }
sinon pour l'arborescence ca donne ca :
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 package org; public class Entree{ private String nom; private String prenom; private String telephone; private String mail; public Entree() { nom = ""; prenom = ""; telephone = ""; mail = ""; } public Entree(String nom, String prenom, String telephone, String mail) { super(); this.nom = nom; this.prenom = prenom; this.telephone = telephone; this.mail = mail; } public String getNom() { return nom; } public String getPrenom() { return prenom; } public String getTelephone() { return telephone; } public String getMail() { return mail; } public void setNom(String nom) { this.nom = nom; } public void setPrenom(String prenom) { this.prenom = prenom; } public void setTelephone(String telephone) { this.telephone = telephone; } public void setMail(String mail) { this.mail = mail; } }
classes--
|-org--
||-Entree
|
|-servlet--
||-AdminEntree
Merci d'avance
Aurevoi
Partager