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 .
Partager