IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Servlets/JSP Java Discussion :

Probleme d'utilisation de classe dans JSP /Tomcat


Sujet :

Servlets/JSP Java

  1. #1
    Membre éclairé
    Inscrit en
    Août 2010
    Messages
    416
    Détails du profil
    Informations forums :
    Inscription : Août 2010
    Messages : 416
    Points : 828
    Points
    828
    Par défaut Probleme d'utilisation de classe dans JSP /Tomcat
    Bonjour,

    J'ai fait un programme java qui fait des tests sur le réseau, quand je veux afficher les résultats sur une interface web, je recois le message d'erreut suivant

    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
     
    Stacktrace: at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:95)
    	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    	at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
    	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:367)
    	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:345)
    	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
    	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:342)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
    	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Voici mon code

    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
     
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page import="java.util.Date"%>
    <%@ page import="marouene.TestPerformance"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Demo</title>
    </head>
    <body>
     
     
     
    pageWriter.println("<%= new TestPerformance() %>")
    </body>
    </html>

  2. #2
    Membre éprouvé Avatar de noOneIsInnocent
    Homme Profil pro
    Inscrit en
    Mai 2002
    Messages
    1 037
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2002
    Messages : 1 037
    Points : 1 161
    Points
    1 161
    Par défaut
    Bonjour

    la première chose que je vois est que tu n'as pas déclarer l'import ta classe TestPerformance dans ta JSP

  3. #3
    Membre éclairé
    Inscrit en
    Août 2010
    Messages
    416
    Détails du profil
    Informations forums :
    Inscription : Août 2010
    Messages : 416
    Points : 828
    Points
    828
    Par défaut
    j'avais corriger ca, j'ai importer ma classe et c'est bon, mais toujours le même probleme

  4. #4
    Membre éprouvé Avatar de noOneIsInnocent
    Homme Profil pro
    Inscrit en
    Mai 2002
    Messages
    1 037
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2002
    Messages : 1 037
    Points : 1 161
    Points
    1 161
    Par défaut
    et tu es sûr de ton pageWriter
    il ne manque pas quelque chose pour pouvoir l'utiliser tel quel dans une JSP ?

  5. #5
    Membre éclairé
    Inscrit en
    Août 2010
    Messages
    416
    Détails du profil
    Informations forums :
    Inscription : Août 2010
    Messages : 416
    Points : 828
    Points
    828
    Par défaut
    j'ai fais qqs corrections, je n'ai plus ce type d'erreurs, mais je n'arrive pas à faire appel a ma classe dans ma page web
    voici le code de ma jsp
    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
     
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
     
        <%@ page import="marouene.*" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <html>
    <body>
     <% out.println("<h1>Une JSP !</h1>"); %> 
     <% Pingtest ping= new Pingtest(); %>
     
    </body>
    </html>
     
    </body>
    </html>
    cette fonction est supposé retourner une chaine de caracteres comme le montre ce code

    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
    35
    36
    37
    38
    39
    40
    41
    42
     
    package marouene;
    import java.net.*;
    import java.io.*;
    import java.util.*;
     
    public class Pingtest {
    	 public static void main(String[] args) {
    String Taux;
    String Moyen;
    String ip = args[0];
    String pingResult = "";
    int position;
    int position1;
    String pingCmd = "ping -l 1500 -n 8 " + ip;
     
    try {
    Runtime r = Runtime.getRuntime();
    Process p = r.exec(pingCmd);
     
    BufferedReader in = new BufferedReader(new
    InputStreamReader(p.getInputStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null) {
    //System.out.println(inputLine);
    pingResult += inputLine;
    }
    position = pingResult.indexOf("perte");
    position1 = pingResult.indexOf("Moyenne");
    //System.out.println(position);
    Taux = pingResult.substring(position+5,position+8);
    System.out.println("La perte en % est : "+Taux);
    Moyen = pingResult.substring(position1+10,position1+14);
    System.out.println("le taux Moyen en Ms est : "+Moyen);
    in.close();
     
    }
    catch (IOException e) {
    System.out.println(e);
    }
     
    }}

    mais j'ai cette erreur lors de l'ouverture de ma page

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    marouene.Pingtest@135a92b

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [JSP][Tomcat][Débutant] Utiliser une classe dans du JSP
    Par mavina dans le forum Servlets/JSP
    Réponses: 4
    Dernier message: 09/05/2007, 11h50
  2. utilisation de classe dans une DLL
    Par _stef_ffff_f34 dans le forum Windows
    Réponses: 1
    Dernier message: 10/02/2006, 16h03
  3. Probleme d utilisation de template dans le cpp
    Par Math75 dans le forum Langage
    Réponses: 2
    Dernier message: 07/10/2005, 16h26
  4. utilisation de CLASS dans un formulaire
    Par lepierre dans le forum Balisage (X)HTML et validation W3C
    Réponses: 3
    Dernier message: 18/11/2004, 16h38
  5. [Debutant] probleme pour utiliser les classes d'un .jar
    Par pissek dans le forum Eclipse Java
    Réponses: 3
    Dernier message: 12/05/2004, 18h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo