It seems to be a very simple problem, but i don't get it. I'm trying to computerize a storage / an inventory with Java EE, JSP and tomcat (i'm french by the way, sorry by advance for language mistakes)
What I tried to do here :
I have an Excel file (.xls) which holds the role of the database. I read the .xls file and define for every line an Object ("Outil" by translation it's a "Tool") as you can see in "CommandeOutils.java" ("/WEB-INF/classes/pac/cmd").
package pac.cmd;
import javax.servlet.http.HttpServletRequest;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.apache.poi.ss.usermodel.*;
import pac.bdd.beans.Outil;
/**CommandeOutils.java*/
public class CommandeOutils implements Commande
{
private final String next;
private static FileOutputStream fos;
private static Row row;
private static Cell cell;
public static Outil[] outil;
public CommandeOutils(String next) {
this.next = next;
}
public String execute(HttpServletRequest req) throws Exception
{
FileInputStream fis = new FileInputStream("C:\\Users\\lomoc\\Desktop\\INVENTAIRE_NOUVEAU_OUTILLAGE.xls");
Workbook wb = WorkbookFactory.create(fis);
Sheet sh = wb.getSheet("listing");
int noOfRows = sh.getLastRowNum();
for (int i = 1; i < noOfRows; i++)
{
if (sh.getRow(i) == null)
{
break;
}
outil[i] = new Outil(sh.getRow(i).getCell(0).getStringCellValue(), (sh.getRow(i).getCell(1).getStringCellValue()),
sh.getRow(i).getCell(2).getStringCellValue(), sh.getRow(i).getCell(3).getStringCellValue(),
sh.getRow(i).getCell(4).getStringCellValue(), sh.getRow(i).getCell(5).getDateCellValue(),
sh.getRow(i).getCell(6).getDateCellValue(), sh.getRow(i).getCell(7).getBooleanCellValue(),
sh.getRow(i).getCell(8).getBooleanCellValue(), sh.getRow(i).getCell(9).getDateCellValue(),
sh.getRow(i).getCell(10).getDateCellValue(), sh.getRow(i).getCell(11).getStringCellValue(),
sh.getRow(i).getCell(12).getStringCellValue(), sh.getRow(i).getCell(13).getStringCellValue(),
sh.getRow(i).getCell(14).getStringCellValue(), sh.getRow(i).getCell(15).getDateCellValue(),
sh.getRow(i).getCell(16).getBooleanCellValue(), sh.getRow(i).getCell(17).getBooleanCellValue());
}
req.setCharacterEncoding("UTF-8");
req.getServletContext().getRequestDispatcher( "/WEB-INF/outils.jsp" );
return next;
}
}
My "Outil" object is define in "Outil" class ("/WEB-INF/classes/pac/bdd/beans").
package pac.bdd.beans;
import java.util.Date;
public class Outil
{
private String designation;
private String numInterne;
private String numSerie;
private String marque;
private String classement;
private Date dateAchat;
private Date dateFinDeVie;
private boolean verifInterne;
private boolean verifExterne;
private Date derniereVerification;
private Date prochaineVerification;
private String observation;
private String utilisateur;
private String dateSortie;
private String utilisateurPrecedent;
private Date dateRetour;
private boolean conforme;
private boolean nonConforme;
public Outil(String designation, String numInterne, String numSerie, String marque,
String classement, Date dateAchat, Date dateFinDeVie, boolean verifInterne,
boolean verifExterne, Date derniereVerification, Date prochaineVerification,
String observation, String utilisateur, String dateSortie, String utilisateurPrecedent,
Date dateRetour, boolean conforme, boolean nonConforme)
{
this.designation = designation;
this.numInterne = numInterne;
this.numSerie = numSerie;
this.marque = marque;
this.classement = classement;
this.dateAchat = dateAchat;
this.dateFinDeVie = dateFinDeVie;
this.verifInterne = verifInterne;
this.verifExterne = verifExterne;
this.derniereVerification = derniereVerification;
this.prochaineVerification = prochaineVerification;
this.observation = observation;
this.utilisateur = utilisateur;
this.dateSortie = dateSortie;
this.utilisateurPrecedent = utilisateurPrecedent;
this.dateRetour = dateRetour;
this.conforme = conforme;
this.nonConforme = nonConforme;
}
/*Hidden Getters & Setters*/
}
In "outils.jsp", i just print for (int i = 0; i < CommandeOutils.outil.length; i++)
in a table with per example for an element out.println("<li>" + CommandeOutils.outil[i].getDesignation() + "</li>");
I compile manually, (same result if i recompile with Intellij Idea), and I got this, i already red topics about that problem, i tried many things and don't figure it out, i don't know if it's a compilation problem, a package problem, the folders tree, imports...
C:\Users\lomoc\Cours\S4\JSP\webapps\V4_2\WEB-INF>javac classes\pac\cmd\*.java
classes\pac\cmd\CommandeOutils.java:9: error: package pac.bdd.beans does not exist
import pac.bdd.beans.Outil;
^
classes\pac\cmd\CommandeOutils.java:19: error: cannot find symbol
public static Outil[] outil;
^
symbol: class Outil
location: class CommandeOutils
classes\pac\cmd\CommandeOutils.java:37: error: cannot find symbol
outil[i] = new Outil(sh.getRow(i).getCell(0).getStringCellValue(),
(sh.getRow(i).getCell(1).getStringCellValue()),
^
symbol: class Outil
location: class CommandeOutils
3 errors
Thanks by advance