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

JSF Java Discussion :

Java Script file dans une page JSF


Sujet :

JSF Java

  1. #1
    Membre averti
    Femme Profil pro
    �tudiant
    Inscrit en
    F�vrier 2011
    Messages
    50
    D�tails du profil
    Informations personnelles :
    Sexe : Femme

    Informations professionnelles :
    Activit� : �tudiant

    Informations forums :
    Inscription : F�vrier 2011
    Messages : 50
    Par d�faut Java Script file dans une page JSF
    Bonjour � tous ,

    je r�alise une page web JSF en utilisant netbeans 6.8, dont y a un bouton show qui , avec un click au dessus, normalement un code javascript se lance.
    j'ai pr�parer le code javascript dans un fichier executeCmd.js , et je l'appele dans la page JSF, le probl�me c'est que �a se lance plus.

    donc j'ai essay� le code javascript sur une page html simple et �a marche bien.

    voil� le code java script du fichier executeCmd.js

    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
    /* 
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
     
     
     function lancer()
     
     {
      var ws=new ActiveXObject("WScript.Shell");
      try           {
     
                       ws.run ('cmd /k cd C:\\Program Files\\videoLAN\\VLC ');
                       ws.run ('vlc');
     
     
     
     
                    }
      catch(erreur) {
                       alert(erreur.description);
                    }
     }

    et voil� le code de la page JSF
    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
    56
    57
    58
    59
    60
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core"
          xml:c="http://java.sun.com/jstl/core"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          >
        <h:head>
            <title>Facelet Title</title>
        </h:head>
        <h:body>
     
            <h:form>
                <h:panelGrid columns="2">
                <h:outputLabel value="#{bundle.CreateVideoLabel_title}" for="title" />
                <h:outputText  value="#{videoController.videoRecover.title}"/>
     
                <h:outputLabel value="#{bundle.CreateVideoLabel_author}" for="author" />
                <h:outputText  value="#{videoController.videoRecover.author}"/>
     
                <h:outputLabel value="#{bundle.CreateVideoLabel_producer}" for="producer" />
                <h:outputText  value="#{videoController.videoRecover.producer}"/>
     
                <h:outputLabel value="#{bundle.CreateVideoLabel_country}" for="country" />
                <h:outputText  value="#{videoController.videoRecover.country}"/>
     
                <h:outputLabel value="#{bundle.CreateVideoLabel_productionYear}" for="productionYear" />
                <h:outputText  value="#{videoController.videoRecover.productionYear}"/>
     
                <h:outputLabel value="#{bundle.CreateVideoLabel_duration}" for="duration" />
                <h:outputText  value="#{videoController.videoRecover.duration}"/>
     
                <h:outputLabel value="#{bundle.CreateVideoLabel_resume}" for="resume" />
                <h:outputText  value="#{videoController.videoRecover.resume}"/>
     
                <h:outputLabel value="#{bundle.CreateVideoLabel_note}" for="note" />
                <h:outputText  value="#{videoController.videoRecover.note}"/>
     
                <h:outputLabel value="#{bundle.CreateVideoLabel_type}" for="type" />
                <h:outputText  value="#{videoController.videoRecover.type}"/>
     
                <h:outputLabel value="#{bundle.CreateVideoLabel_size}" for="size" />
                <h:outputText  value="#{videoController.videoRecover.size}"/>
     
                <h:outputLabel value="#{bundle.CreateVideoLabel_url}" for="url" />
                <h:outputText  value="#{videoController.videoRecover.url}"/>
                </h:panelGrid>
     
            </h:form>
            <h:form>
     
                    <h:outputScript library="../resources/JavaScript" name="executeCmd.js" target="head"/>
                    <h:commandButton value="Show1" onclick="lancer();"/>
                    <h:button value="Show2" onclick="lancer();" />
     
           </h:form>
        </h:body>
    </html>

    j'ai essay� dans ce code 2 mani�res possibles pour appeler la fonction

    que pensez vous de ce probl�me, pouvez vous m'aidez SVP ?? merci d'avance .

  2. #2
    Membre averti
    Femme Profil pro
    �tudiant
    Inscrit en
    F�vrier 2011
    Messages
    50
    D�tails du profil
    Informations personnelles :
    Sexe : Femme

    Informations professionnelles :
    Activit� : �tudiant

    Informations forums :
    Inscription : F�vrier 2011
    Messages : 50
    Par d�faut
    JSF que j'utilise est 2.0,

  3. #3
    Membre averti
    Femme Profil pro
    �tudiant
    Inscrit en
    F�vrier 2011
    Messages
    50
    D�tails du profil
    Informations personnelles :
    Sexe : Femme

    Informations professionnelles :
    Activit� : �tudiant

    Informations forums :
    Inscription : F�vrier 2011
    Messages : 50
    Par d�faut ActiveXobject n'a ps pu cr�er un objet sur une page html
    bonjour � tous;

    voil� le message d'erreur qui s'affiche


    D�tails de l�erreur de la page Web

    Agent utilisateur : Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; BTRS31753; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; .NET4.0E)
    Horodateur : Thu, 14 Apr 2011 10:08:34 UTC


    Message*: Un composant ActiveX ne peut pas cr�er un objet.
    Ligne*: 9
    Caract�re*: 3
    Code*: 0
    URI*: http://localhost:19042/VOD/faces/portal/test.html


    Message*: Un composant ActiveX ne peut pas cr�er un objet.
    Ligne*: 9
    Caract�re*: 3
    Code*: 0
    URI*: http://localhost:19042/VOD/faces/portal/test.html

Discussions similaires

  1. R�ponses: 1
    Dernier message: 29/08/2010, 22h50
  2. Appeller un script shell dans une page html
    Par Scurz dans le forum G�n�ral Conception Web
    R�ponses: 2
    Dernier message: 04/05/2007, 14h50
  3. [Syst�me] Executer un script CGI dans une page php
    Par RadicalBob dans le forum Langage
    R�ponses: 1
    Dernier message: 25/04/2007, 17h46
  4. R�ponses: 6
    Dernier message: 02/04/2007, 19h13
  5. Int�grer un script python dans une page Web
    Par Mysti� dans le forum R�seau/Web
    R�ponses: 4
    Dernier message: 02/11/2006, 10h20

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