Foros del Web » Programación para mayores de 30 ;) » Java »

Agregar un archivo JavaScript a JSF

Estas en el tema de Agregar un archivo JavaScript a JSF en el foro de Java en Foros del Web. Buenas noches compañeros del foro. Es que quisiera agregar una archivo JavaScript a una pagina web que estoy haciendo con JAVA JSF. @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código ...
  #1 (permalink)  
Antiguo 16/07/2015, 19:06
 
Fecha de Ingreso: mayo-2013
Ubicación: bogota
Mensajes: 157
Antigüedad: 10 años, 11 meses
Puntos: 2
Agregar un archivo JavaScript a JSF

Buenas noches compañeros del foro.
Es que quisiera agregar una archivo JavaScript a una pagina web que estoy haciendo con JAVA JSF.

Código Java:
Ver original
  1. <html xmlns="http://www.w3.org/1999/xhtml"
  2.       xmlns:h="http://java.sun.com/jsf/html"
  3.       xmlns:ui="http://java.sun.com/jsf/facelets">
  4.     <h:head>
  5.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6.        
  7.         <script type="text/javascript" src = "JSProductos.js" language="javascript"></script>
  8.         <title>Facelet Title</title>
  9.     </h:head>
  10.     <h:body>
  11. </h:body>
  12. </h:html>

y para probarla utilizo el JSProductos.js pero no funciona:

Código Javascript:
Ver original
  1. addEvent(window,"load",inicio,false);
  2.    
  3.     function inicio(){
  4.         alert("hola");
  5.     }
  6.  
  7.  
  8. function addEvent(elemento,evento,metodo,estado){
  9. if(elemento.attachEvent)
  10. elemento.attachEvent("on"+evento,metodo);
  11. else
  12. if(elemento.addEventListener)
  13. elemento.addEventListener(evento,metodo,estado);
  14. }

Etiquetas: javascript, jsf, jsp
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:22.