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 :

Lien hypertexte, variable JSP [Débutant(e)]


Sujet :

Servlets/JSP Java

  1. #1
    Nouveau membre du Club
    Inscrit en
    Décembre 2010
    Messages
    37
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 37
    Points : 28
    Points
    28
    Par défaut Lien hypertexte, variable JSP
    Bonsoir
    j'ai une page jsp qui affiche des informations journalières mon objectif est de creer un lien hypertexte pour chaque jour qui me permet de voir les infos en detail (pour chaque jour)
    voici mon
    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
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
     
    <%@ page import = "java.util.Date,java.util.Locale,java.text.SimpleDateFormat,java.text.DateFormat,java.text.ParseException,java.io.*,java.sql.*"
     contentType="text/html; charset=utf-8" %>
     <html>
    <head>
    <title>test</title>
    </head>
    <body>
     
    <% 
     
    Class.forName("oracle.jdbc.driver.OracleDriver" );
     
     
     
     String URL = "jdbc:oracle:thin:@xxxx";
     
    Connection con = DriverManager.getConnection(URL,"xxxx","xxx" );
     
    Statement stmt = con.createStatement();
     
    ResultSet req = stmt.executeQuery("select to_char(date_appel,'dd mon yy'),nombre_rejet,duree_rejet,round(pr_nbr)||'%',round(pr_duree)||'%' from tab1 where code= 'MO'" );
     
                    out.println("<table border='1'>");
                    out.println("<tr>");
                    out.println("<th>" +"Date_appel"+  "</th>");
                    out.println("<th>" +"Nbre_Rejet"+  "</th>");
                    out.println("<th>" +"Duree_rejet"+  "</th>");
                    out.println("<th>" +"Pr_Nbre_rejet"+  "</th>");
                    out.println("<th>" +"Pr_Duree_rejet"+  "</th>");
                    out.println("</tr>");
                    
                    out.println("<tr>");
                    
     String d_appel= null ;
    while (req.next ()){
                      d_appel= req.getString(1) ;
    out.println("<td> <a href =\"te.jsp\"> "+d_appel+" </a>  </td>");
    out.println("<td>" + req.getString (2) + "</td>");
    out.println("<td>" + req.getString (3) + "</td>");
    out.println("<td>" + req.getString (4) + "</td>");
    out.println("<td>" + req.getString (5) + "</td>");
            out.println("</tr>");
                    
    }
    out.println("</table>");   
                    
     
            
     
     
     %>
     
     </body>
    </html>
    pourriez vous m'aider j'ai deja essayer mais j'ai trouvé des soucis avec l'exploitation des dates affiché dans le tableau a cause de sa variabilité
    (j'utilise appache 7.0 je programme sur notepad+)
    merci d'avance

  2. #2
    Nouveau membre du Club
    Inscrit en
    Décembre 2010
    Messages
    37
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 37
    Points : 28
    Points
    28
    Par défaut
    Citation Envoyé par essaitiano Voir le message
    Bonsoir
    j'ai une page jsp qui affiche des informations journalières mon objectif est de creer un lien hypertexte pour chaque jour qui me permet de voir les infos en detail (pour chaque jour)
    voici mon
    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
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
     
    <%@ page import = "java.util.Date,java.util.Locale,java.text.SimpleDateFormat,java.text.DateFormat,java.text.ParseException,java.io.*,java.sql.*"
     contentType="text/html; charset=utf-8" %>
     <html>
    <head>
    <title>test</title>
    </head>
    <body>
     
    <% 
     
    Class.forName("oracle.jdbc.driver.OracleDriver" );
     
     
     
     String URL = "jdbc:oracle:thin:@xxxx";
     
    Connection con = DriverManager.getConnection(URL,"xxxx","xxx" );
     
    Statement stmt = con.createStatement();
     
    ResultSet req = stmt.executeQuery("select to_char(date_appel,'dd mon yy'),nombre_rejet,duree_rejet,round(pr_nbr)||'%',round(pr_duree)||'%' from tab1 where code= 'MO'" );
     
                    out.println("<table border='1'>");
                    out.println("<tr>");
                    out.println("<th>" +"Date_appel"+  "</th>");
                    out.println("<th>" +"Nbre_Rejet"+  "</th>");
                    out.println("<th>" +"Duree_rejet"+  "</th>");
                    out.println("<th>" +"Pr_Nbre_rejet"+  "</th>");
                    out.println("<th>" +"Pr_Duree_rejet"+  "</th>");
                    out.println("</tr>");
                    
                    out.println("<tr>");
                    
     String d_appel= null ;
    while (req.next ()){
                      d_appel= req.getString(1) ;
    out.println("<td> <a href =\"te.jsp\"> "+d_appel+" </a>  </td>");
    out.println("<td>" + req.getString (2) + "</td>");
    out.println("<td>" + req.getString (3) + "</td>");
    out.println("<td>" + req.getString (4) + "</td>");
    out.println("<td>" + req.getString (5) + "</td>");
            out.println("</tr>");
                    
    }
    out.println("</table>");   
                    
     
            
     
     
     %>
     
     </body>
    </html>
    pourriez vous m'aider j'ai deja essayer mais j'ai trouvé des soucis avec l'exploitation des dates affiché dans le tableau a cause de sa variabilité
    (j'utilise appache 7.0 je programme sur notepad+)
    merci d'avance
    Pas de solution !!

  3. #3
    Membre averti Avatar de florentB
    Homme Profil pro
    Développeur Java
    Inscrit en
    Décembre 2006
    Messages
    332
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Décembre 2006
    Messages : 332
    Points : 441
    Points
    441
    Par défaut
    Salut.

    Alors avant de commencer à faire ta deuxième page, je pense que tu devrais jeter un oeil au modèle MVC.
    Ouvrir une connexion dans ta page JSP c'est moyen ...

    Sinon, pour ton problème :
    dans ta boucle :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    out.println("<td> <a href ='afficherDate?date=<%=d_appel%>'>" +d_appel+" </a>  </td>");
    avec afficherDate une référence vers ta servlet de traitement.

Discussions similaires

  1. Liens hypertextes variables dans un publipostage
    Par barth95 dans le forum Word
    Réponses: 1
    Dernier message: 24/02/2014, 12h18
  2. [OL-2007] Lien Hypertext Variable d'environnement
    Par draco951 dans le forum Outlook
    Réponses: 5
    Dernier message: 01/11/2012, 09h35
  3. Réponses: 4
    Dernier message: 14/12/2010, 21h58
  4. [XL-2003] lien hypertexte variable
    Par cedrink dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 06/12/2010, 13h13
  5. Liens hypertextes variables
    Par Tranberdo dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 28/10/2004, 10h09

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