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