Aide svp

Résolu
cs_miyavi Messages postés 3 Date d'inscription mercredi 2 février 2005 Statut Membre Dernière intervention 13 octobre 2005 - 13 oct. 2005 à 15:04
cs_ducheseb Messages postés 344 Date d'inscription mardi 18 mai 2004 Statut Membre Dernière intervention 23 juin 2006 - 13 oct. 2005 à 15:23
bonjour

j ai mon petit script dont je n arrive pas a déclarer un tableau:

code:
<%
FileReader lecteur = new FileReader(getServletContext().getRealPath("/")+"form/toto.txt");
BufferedReader bLecteur = new BufferedReader(lecteur);
String ligne = bLecteur.readLine();
String texte=new String();
String[] tableau;
String[] tabl;
String archives=new String();
String S_soustitre=new String();
int I_nbligne=0;
while (ligne != null) {
texte=texte+ligne+"&&";
ligne = bLecteur.readLine();
}

tableau=texte.split("&&");
for(int I_tableau=0;I_tableau<tableau.length-1;I_tableau++){
tabl=tableau[I_tableau].split("_");
}

S_soustitre=tabl[1];
int i =0;
for(i=0;i<tabl.length;i++){
while (I_nbligne!=(tabl.length-1)){
if (tabl[I_nbligne+1].compareTo(S_soustitre)==0)
archives=archives+"<li>"+tabl[I_nbligne+2]+"</li>" ;
I_nbligne++;
}
I_nbligne=0;
}

out.print(S_soustitre+"
");
out.print(archives);
%>

a ce passage ( texte en rose) tomcat me dit :
"variable tabl might not have been initialized"

merci de m'aider a declarer cette variable correctement ^^

1 réponse

cs_ducheseb Messages postés 344 Date d'inscription mardi 18 mai 2004 Statut Membre Dernière intervention 23 juin 2006 9
13 oct. 2005 à 15:23
tu peux mettre dans la déclaration:
String []tabl = null;
Rejoignez-nous