probleme utilisation classe java dans jsp
Bonjour à tous,
Je suis débutante en java et en informatique.
J'ai ecrit une jsp qui correspond à l'affichage d'un formulaire. Les données de ce formulaire doivent ensuite etre récupérer par une autre jsp (RetrieveFormData.jsp). Cette dernière utilise une classe java pour stocker les données puis les restituer.
Le problème ets que j'obtiens un message d'erreur quand je valide mon formulaire.
Il ne reconnait pas la classe en question.
Voici un extrait du code du formulaire :
Code:
<FORM NAME="formulaireClone" ACTION="RetrieveFormData_original.jsp" METHOD="POST">
ensuite c'est un formulaire html tout simple.
Ce formulaire est inséré dans une jsp dont voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
<html>
<head>
<link rel="stylesheet" href="ForESTDB.css" type="text/css">
<title>
Bienvenue sur ForESTDB
</title>
</head>
<body>
<p>
<!--content-->
<%@include file="formulaire2.jsp"%>
</p>
</body>
</html> |
la classe java est la suivante :
Code:
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
| public class Clone{
public String nomClone= null;
public String regulation=null;
public String remarques=null;
public String espece=null;
public String sexe=null;
public String tissu=null;
public String contaminant=null;
public float concentration=0;
public float duree=0;
public String tidalite=null;
//constructeur
public Clone(){
}
//méthodes
public String getNomClone(){
return nomClone;
}
public String getRegulation(){
return regulation;
}
public String getRemarques(){
return remarques;
}
public String getEspece(){
return espece;
}
public String getSexe(){
return sexe;
}
public String getTissu(){
return tissu;
}
public String getContaminant(){
return contaminant;
}
public float getConcentration(){
return concentration;
}
public float getDuree(){
return duree;
}
public String getTidalite(){
return tidalite;
}
public void setNomClone(String value){
nomClone=value;
}
public void setRegulation(String value){
regulation=value;
}
public void setRemarques(String value){
remarques=value;
}
public void setEspece(String value){
espece=value;
}
public void setTissu(String value){
tissu=value;
}
public void setSexe(String value){
sexe=value;
}
public void setContaminant(String value){
contaminant=value;
}
public void setConcentration(float value){
concentration=value;
}
public void setDuree(float value){
duree=value;
}
public void setTidalite(String value){
tidalite=value;
}
} |
le fichier .class est dans /usr/local/tomcat/webapps/ForEST/WEB-INF/classes/interface/Clone.class
le code de la jsp RetrieveFormData :
Code:
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 65 66 67
| <%@ page import="interface.Clone"%>
<!-- crée l'instance du bean Clone avec un id de "clone" -->
<jsp:useBean id="clone" scope="request" class="interface.Clone" />
<!-- Met les valeurs du bean aux valeurs de la requete -->
<jsp:setProperty name="clone" property="*" />
<html>
<head>
<link rel="stylesheet" href="ForESTDB.css" type="text/css">
</head>
<title>
Résumé des informations
</title>
<body>
<!--interface-->
<%@include file="interface.jsp"%>
<!--content-->
<div id="content">
<h4><%=clone.getNomClone() %></h4>
<table cellpadding="3" cellspacing="10">
<tr>
<th>
Clone
</th>
</tr>
<tr>
<td/>
<td>
<b>Régulation</b> : <%=clone.getRegulation() %><br>
<b>Remarques</b> : <%=clone.getRemarques() %><br>
</td>
</tr>
<tr>
<th>
Animal
</th>
</tr>
<tr>
<td/>
<td>
<b>Espèce</b> : <%=clone.getEspece() %><br>
<b>Sexe</b> : <%=clone.getSexe() %><br>
<b>Tissu</b> : <%=clone.getTissu() %><br>
</td>
</tr>
<tr>
<th>
Exposition
</th>
</tr>
<tr>
<td/>
<td>
<b>Contaminant</b> : <%=clone.getContaminant() %><br>
<b>Durée</b> : <%=clone.getDuree() %><br>
<b>Concentration</b> : <%=clone.getConcentration() %><br>
<b>Tidalité</b> : <%=clone.getTidalite() %><br>
</td>
</tr>
</table>
</div>
</body>
</html> |
Mon classpath dit : /usr/java/jdk1.5.0_07/lib/tools.jar:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/webapps/ForEST/WEB-INF/classes
et le message d'erreur sous tomcat est
Citation:
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 2 in the jsp file: /jsp/RetrieveFormData_original.jsp
Generated servlet error:
[javac] Compiling 1 source file
/usr/local/jakarta-tomcat-4.1.31/work/Standalone/localhost/ForEST/jsp/RetrieveFormData_original_jsp.java:7: <identifier> expected
import interface.Clone;
^
/usr/local/jakarta-tomcat-4.1.31/work/Standalone/localhost/ForEST/jsp/RetrieveFormData_original_jsp.java:7: <identifier> expected
import interface.Clone;
^
/usr/local/jakarta-tomcat-4.1.31/work/Standalone/localhost/ForEST/jsp/RetrieveFormData_original_jsp.java:7: '{' expected
import interface.Clone;
etc...
Si quelqu'un connait la solution parce que ça fait plusieurs jours que je rame..
Merci