$.getJSON correctly executed, but js tags not updated - getjson

I'm not an expert on JS and i'd like to have any support.
I'm trying to update many tags (1 in code here under) every 1000ms.
I'm using this code :
<script type="text/javascript">
$(document).ready(function(){
$.ajaxSetup({ cache: false });
setInterval(function() {
$.getJSON("Maj_Tag_PLC.htm", function(data){
$('#watchdog').text(data.watchdog);
});
},1000);
});
This getjson seems working because i see "the response" in network tab (chrome) with updated tags :
{ "watchdog" : 29304, "count" : 29304, "Etat_Lampe_Plafond_Cuisine" : 0, "Etat_Lampe_Tetes_Murs_Cuisine" : 0, "Etat_Lampe_Plafond_Salon_Rue" : 0, "Etat_Lampe_Plafond_Salon_Jardin" : 0, "Etat_Lampe_Tetes_Murs_Salon" : 0, "Temps_Restant_Plafond_Cuisine" : T#0MS, "Temps_Restant_Tetes_Murs_Cuisine" : T#0MS, "Temps_Restant_Plafond_Salon_Rue" : T#0MS, "Temps_Restant_Plafond_Salon_Jardin" : T#0MS, "Temps_Restant_Tetes_Murs_Salon" : T#0MS, "Temps_Total_Plafond_Cuisine" : T#0MS, "Temps_Total_Tetes_Murs_Cuisine" : T#0MS, "Temps_Total_Plafond_Salon_Rue" : T#0MS, "Temps_Total_Plafond_Salon_Jardin" : T#0MS, "Temps_Total_Tetes_Murs_Salon" : T#0MS }
--> this correpond to my "Maj_Tag_PLC.htm"
Great !
But, the following part of my code seems never executed :
$('#watchdog').text(data.watchdog)
I say that because watchdog field is never update and script never stop on this line if i put a breakpoint on it.
Any idea what happend?
Thanks for you help
(i ve read some informations about "asynchronous query" and the fact that this part of "script could be executed before the answer could be returned" but i don't really understand what does it mean and how to solve it.)
{
"watchdog" : :="DB_HMI".Watchdog_int:,
"count" : :="DB_HMI".Watchdog_int:,
"Etat_Lampe_Plafond_Cuisine" : :="DB_HMI".Lampe_Plafond_Cuisine.Etat_Lampe:,
"Etat_Lampe_Tetes_Murs_Cuisine" : :="DB_HMI".Lampe_Tetes_Murs_Cuisine.Etat_Lampe:,
"Etat_Lampe_Plafond_Salon_Rue" : :="DB_HMI".Lampe_Plafond_Salon_Rue.Etat_Lampe:,
"Etat_Lampe_Plafond_Salon_Jardin" : :="DB_HMI".Lampe_Plafond_Salon_Jardin.Etat_Lampe:,
"Etat_Lampe_Tetes_Murs_Salon" : :="DB_HMI".Lampe_Tetes_Murs_Salon.Etat_Lampe:,
"Temps_Restant_Plafond_Cuisine" : :="DB_HMI".Lampe_Plafond_Cuisine.Temps_Restant:,
"Temps_Restant_Tetes_Murs_Cuisine" : :="DB_HMI".Lampe_Tetes_Murs_Cuisine.Temps_Restant:,
"Temps_Restant_Plafond_Salon_Rue" : :="DB_HMI".Lampe_Plafond_Salon_Rue.Temps_Restant:,
"Temps_Restant_Plafond_Salon_Jardin" : :="DB_HMI".Lampe_Plafond_Salon_Jardin.Temps_Restant:,
"Temps_Restant_Tetes_Murs_Salon" : :="DB_HMI".Lampe_Tetes_Murs_Salon.Temps_Restant:,
"Temps_Total_Plafond_Cuisine" : :="DB_HMI".Lampe_Plafond_Cuisine.Temps_Total:,
"Temps_Total_Tetes_Murs_Cuisine" : :="DB_HMI".Lampe_Tetes_Murs_Cuisine.Temps_Total:,
"Temps_Total_Plafond_Salon_Rue" : :="DB_HMI".Lampe_Plafond_Salon_Rue.Temps_Total:,
"Temps_Total_Plafond_Salon_Jardin" : :="DB_HMI".Lampe_Plafond_Salon_Jardin.Temps_Total:,
"Temps_Total_Tetes_Murs_Salon" : :="DB_HMI".Lampe_Tetes_Murs_Salon.Temps_Total:
}
<!-- AWP_In_Variable Name='"DB_HMI".Watchdog_int' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Cave.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Facade_Jardin.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Annexe_Veranda_Buanderie.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Garage.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Annexe_Grenier.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_WC.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Cuisine.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Tetes_Murs_Cuisine.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Salon_Jardin.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Salon_Rue.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Tetes_Murs_Salon.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Facade_Rue.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Chambre_Amis.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Chambre_TAO.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Entre_Fenetre_Chambre_TAO.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Chambre_Parent.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_SDB.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Hall_De_Nuit.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Grenier.Cmd_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Cave.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Facade_Jardin.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Annexe_Veranda_Buanderie.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Garage.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Annexe_Grenier.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_WC.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Cuisine.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Tetes_Murs_Cuisine.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Salon_Jardin.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Salon_Rue.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Tetes_Murs_Salon.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Facade_Rue.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Chambre_Amis.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Chambre_TAO.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Entre_Fenetre_Chambre_TAO.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Chambre_Parent.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_SDB.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Hall_De_Nuit.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Grenier.Etat_Lampe' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Cave.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Facade_Jardin.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Annexe_Veranda_Buanderie.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Garage.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Annexe_Grenier.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_WC.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Cuisine.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Tetes_Murs_Cuisine.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Salon_Jardin.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Salon_Rue.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Tetes_Murs_Salon.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Facade_Rue.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Chambre_Amis.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Chambre_TAO.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Entre_Fenetre_Chambre_TAO.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Chambre_Parent.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_SDB.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Hall_De_Nuit.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Grenier.Temps_Restant' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Cave.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Facade_Jardin.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Annexe_Veranda_Buanderie.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Garage.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Annexe_Grenier.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_WC.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Cuisine.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Tetes_Murs_Cuisine.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Salon_Jardin.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Salon_Rue.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Tetes_Murs_Salon.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Facade_Rue.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Chambre_Amis.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Chambre_TAO.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Entre_Fenetre_Chambre_TAO.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Chambre_Parent.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_SDB.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Hall_De_Nuit.Temps_Total' -->
<!-- AWP_In_Variable Name='"DB_HMI".Lampe_Plafond_Grenier.Temps_Total' -->
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <meta http-equiv="refresh" content="5" > -->
<script src="jquery-3.4.1.min.js"></script>
<style>
.switch {
position: relative;
display: inline-block;
width: 90px;
height: 34px;
}
.switch input {display:none;}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ca2222;
-webkit-transition: .4s;
transition: .4s;
border-radius: 34px;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #2ab934;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(55px);
}
/*------ ADDED CSS ---------*/
.slider:after
{
content:'OFF';
color: white;
display: block;
position: absolute;
transform: translate(-50%,-50%);
top: 50%;
left: 50%;
font-size: 10px;
font-family: Verdana, sans-serif;
}
input:checked + .slider:after
{
content:'ON';
}
/*--------- END --------*/
/*----------TAbleau -----*/
table
{
border-collapse: collapse;
}
td
{
border: 1px solid black;
}
</style>
</head>
<body>
-- Affichage watchdog mis a jour-----------------
<br />
watchdog :
<label id="watchdog">0</label>
<br />
watchdog 2:
<label id="watchdog2">0</label>
<br /> Lampe Cave etat lampe : <label id="Lampe_Cave_etat_lampe">0</label> <br />
<br />
-- Affichage myint -----------------
<br />
watchdog : :="webdata".myInt:
<br />
-- Affichage bool mis à jour -----------------
<br />
<br /> Bool1 : <label id="bool1">0</label> <br />
------------------ Gestion lumières-------------------
<br />
<table>
<tr>
<td> Plafond_Cuisine </td>
<td> <label id= "switch" name="switch" class="switch">
<input id= "Etat_Lampe_Plafond_Cuisine" type="checkbox" onclick= send_ajax_request('"DB_HMI".Lampe_Plafond_Cuisine.Cmd_Lampe',"true") >
<span class="slider"></span>
</label>
</td>
<td> Temps restant = <label id="Temps_Restant_Plafond_Cuisine">0</label></td>
<td> Temps Total = <label id="Temps_Total_Plafond_Cuisine">0</label></td>
</tr>
<tr>
<td> Tetes_Murs_Cuisine </td>
<td> <label id= "switch" name="switch" class="switch">
<input id= "Etat_Lampe_Tetes_Murs_Cuisine" type="checkbox" onclick= send_ajax_request('"DB_HMI".Lampe_Tetes_Murs_Cuisine.Cmd_Lampe',"true") >
<span class="slider"></span>
</label>
</td>
<td> Temps restant = <label id="Temps_restant_Tetes_Murs_Cuisine">0</label></td>
<td> Temps Total = <label id="Temps_Total_Tetes_Murs_Cuisine">0</label></td>
</tr>
<tr>
<td> Plafond_Salon_Jardin </td>
<td> <label id= "switch" name="switch" class="switch">
<input id= "Etat_Lampe_Plafond_Salon_Jardin" type="checkbox" onclick= send_ajax_request('"DB_HMI".Lampe_Plafond_Salon_Jardin.Cmd_Lampe',"true") >
<span class="slider"></span>
</label>
</td>
<td> Temps restant = <label id="Temps_Restant_Plafond_Salon_Jardin">0</label></td>
<td> Temps Total = <label id="Temps_Total_Plafond_Salon_Jardin">0</label></td>
</tr>
<tr>
<td> Plafond_Salon_Rue </td>
<td> <label id= "switch" name="switch" class="switch">
<input id= "Etat_Lampe_Plafond_Salon_Rue" type="checkbox" onclick= send_ajax_request('"DB_HMI".Lampe_Plafond_Salon_rue.Cmd_Lampe',"true") >
<span class="slider"></span>
</label>
</td>
<td> Temps restant = <label id="Temps_Restant_Plafond_Salon_rue">0</label></td>
<td> Temps Total = <label id="Temps_Total_Plafond_Salon_rue">0</label></td>
</tr>
<tr>
<td> Tetes_Murs_Salon </td>
<td> <label id= "switch" name="switch" class="switch">
<input id= "Etat_Lampe_Tetes_Murs_Salon" type="checkbox" onclick= send_ajax_request('"DB_HMI".Lampe_Tetes_de_Murs_Salon.Cmd_Lampe',"true") >
<span class="slider"></span>
</label>
</td>
<td> Temps restant = <label id="Temps_Restant_Tetes_Murs_Salon">0</label></td>
<td> Temps Total = <label id="Temps_Total_Tetes_Murs_Salon">0</label></td>
</tr>
</table>
-----------------------------------------------------------------
</body>
<script type="text/javascript">
$(document).ready(function(){
$.ajaxSetup({ cache: false });
setInterval(function() {
$.getJSON("Maj_Tag_PLC.htm", function(data){
$('#watchdog').text(data.watchdog);
});
},1000);
});
/*
$('#watchdog2').text(data.count);
$('#Etat_Lampe_Plafond_Cuisine').prop("checked",data.Etat_Lampe_Plafond_Cuisine);
$('#Etat_Lampe_Tetes_Murs_Cuisine').prop("checked",data.Etat_Lampe_Tetes_Murs_Cuisine);
$('#Etat_Lampe_Plafond_Salon_Rue').prop("checked",data.Etat_Lampe_Plafond_Salon_Rue);
$('#Etat_Lampe_Plafond_Salon_Jardin').prop("checked",data.Etat_Lampe_Plafond_Salon_Jardin);
$('#Etat_Lampe_Tetes_Murs_Salon').prop("checked",data.Etat_Lampe_Tetes_Murs_Salon);
$('#Checkbox_Plafond_Cuisine').prop("checked",data.Etat_Lampe_Plafond_Cuisine);
$('#Temps_Restant_Plafond_Cuisine').text(data.Temps_Restant_Plafond_Cuisine);
$('#Temps_Total_Plafond_Cuisine').text(data.Temps_Total_Plafond_Cuisine);
$('#Checkbox_Tetes_Murs_Cuisine').prop("checked",data.Etat_Lampe_Tetes_Murs_Cuisine);
$('#Temps_Restant_Tetes_Murs_Cuisine').text(data.Temps_Restant_Tetes_Murs_Cuisine);
$('#Temps_Total_Tetes_Murs_Cuisine').text(data.Temps_Total_Tetes_Murs_Cuisine);
$('#Checkbox_Plafond_Salon_Rue').prop("checked",data.Etat_Lampe_Plafond_Salon_Rue);
$('#Temps_Restant_Plafond_Salon_Rue').text(data.Temps_Restant_Plafond_Salon_Rue);
$('#Temps_Total_Plafond_Salon_Rue').text(data.Temps_Total_Plafond_Salon_Rue);
$('#Checkbox_Plafond_Salon_Jardin').prop("checked",data.Etat_Lampe_Plafond_Salon_Jardin);
$('#Temps_Restant_Plafond_Salon_Jardin').text(data.Temps_Restant_Plafond_Salon_Jardin);
$('#Temps_Total_Plafond_Salon_Jardin').text(data.Temps_Total_Plafond_Salon_Jardin);
$('#Checkbox_Tetes_Murs_Salon').prop("checked",data.Etat_Lampe_Tetes_Murs_Salon);
$('#Temps_Restant_Tetes_Murs_Salon').text(data.Temps_Restant_Tetes_Murs_Salon);
$('#Temps_Total_Tetes_Murs_Salon').text(data.Temps_Total_Tetes_Murs_Salon);
*/
function send_ajax_request(variable, fieldId)
{
if (window.XMLHttpRequest)
{
req = new XMLHttpRequest(); // Mozilla and others
}
else if (window.ActiveXObject)
{
req = new ActiveXObject("Microsoft.XMLHTTP"); // Microsoft
}
else
{
alert("Der Browser unterstuezt kein Ajax");
}
// Oringinal code : var value = document.getElementById(fieldId).value;
var value = fieldId.checked;
var req_url = "?"+variable+"="+value+"&"+Math.random();
//debug alert(req_url);
req.open("GET", req_url, false);
//req.onreadystatechange = ajax_callback;
req.send(null);
}
</script>
</html>

I think you need to decode the json formatted data like that :
$.getJSON("Maj_Tag_PLC.htm", function(data){
let result = JSON.parse(data);
$('#watchdog').text(result.watchdog);
});

Thanks for you support.
Correct, It was a parsing issue.
Best wishes

Related

GWTcelltable scrollbar

I have a table with cellTable see the code bellow :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:c="urn:import:com.google.gwt.user.cellview.client"
xmlns:b="urn:import:com.bv.partenaire.graphique.client.ui.button">
<ui:with field='msg' type="com.bv.partenaire.web.client.resources.Messages" />
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel>
<div class="modelBandeau">
<div class="divGauche">
<div class="testClass" style="background-color: green;">
<g:Label styleName="recherche">
<ui:text from="{msg.rechercher}" />
</g:Label>
</div>
<div style="margin-left:10px;margin-top: 1px;">
<g:TextBox ui:field="rechercheBox" />
</div>
</div>
</div>
<table cellspacing='0' cellpadding='0' style='width:100%'>
<tr>
<td valign='top'>
<c:CellTable ui:field="valideursTable" styleName="cellTable"/>
</td>
</tr>
<tr>
<td align='center'>
<c:SimplePager pageSize="10" ui:field="pager" />
</td>
</tr>
</table>
</g:HTMLPanel>
</ui:UiBinder>
the code works fine, my issue is when I have long data in my columns there is no horizontal Scrollbar
I tried to add <g:ScroolPanel> and <g:VerticalPanel> still doesn't work ?
tried to add also some css
table{
display: block;overflow-x: auto;white-space: nowrap;
}
I don't use the DataGrid
Any ideas ?
it works only with CSS, just add the code above and fixed width (950px) and the scrollbar will appear

How to get rid of warnings such as "attrs cannot be resolved as a member of cc"?

How can I get rid of warnings for tags having "cc.attrs.onCompleteJS", "cc.attrs.updateAjax" and "cc.attrs.imageValue"? Each warning has same explanation as "attrs cannot be resolved as a member of cc". I use JSF 2.x as a framework and Eclipse as an editor.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:p="http://primefaces.org/ui">
<composite:interface>
<composite:attribute name="imageValue"></composite:attribute>
<composite:attribute name="updateAjax"></composite:attribute>
<composite:attribute name="onCompleteJS"></composite:attribute>
</composite:interface>
<composite:implementation>
<h:outputStylesheet library="css" name="regionTreeComponent.css"></h:outputStylesheet>
<table style="width: 100%" cellspacing="0" cellpadding="5">
<tr>
<td style="width: 100%">
<p:autoComplete forceSelection="true" id="sTxtRegionName" value="#{regionTreeBean.sRegionName}"
completeMethod="#{regionTreeBean.completeRegionName}" styleClass="sTxtRegionName" />
</td>
<td>
<p:commandButton styleClass="rSearchButton" id="iconOnly" icon="ui-icon-search" actionListener="#{regionTreeBean.searchSelectNode}"
oncomplete="#{cc.attrs.onCompleteJS}" update=":mainForm:treeComponent:regionTree #{cc.attrs.updateAjax}"/>
</td>
</tr>
</table>
<hr style="width: 100%;"></hr>
<div style="text-align: center;">
<h:graphicImage styleClass="headerImage" library="images" name="#{cc.attrs.imageValue}"></h:graphicImage>
<p:outputLabel styleClass="headerLabel" value="#{msgs['treeComponent.regions']}"></p:outputLabel>
</div>
<p:tree value="#{regionTreeBean.rootNode}" var="node"
animate="true" selection="#{regionTreeBean.selectedNode}"
selectionMode="single" styleClass="tree" id="regionTree">
<p:ajax event="select" listener="#{regionTreeBean.onNodeSelect}" update="#{cc.attrs.updateAjax}" oncomplete="#{cc.attrs.onCompleteJS}" />
<p:treeNode styleClass="slTreeNode" icon="region">
<h:outputText value="#{node.REGION_NAME}"/>
</p:treeNode>
</p:tree>
</composite:implementation>
</html>

Materialize CSS - Collapsible & Date Input

I have problem with materialize collapsible and date picker. Collapsible is not even opening on click and the date picker too. Date picker placed in Personal details - collapsible item. Someone please help me to fix collapsible and date picker.
Check: Placements App
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Placements MGIT</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
<!-- If CDN not available, loading JQuery from Server-->
<script>
if (!window.jQuery) {
document.write('<script src="/js/jquery.min.js"><\/script>');
}
</script>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="/js/materialize.min.js"></script>
</head>
<body>
<nav>
<div class="nav-wrapper">
MGIT Placements
<i class="material-icons">M</i>
<ul class="left hide-on-med-and-down">
<li class="active">Login</li>
<li>Register</li>
<li>Upcoming</li>
<li>Contact</li>
</ul>
<ul class="side-nav" id="mobile-demo">
<li class="active">Home</li>
<li>Login</li>
<li>Register</li>
<li>Upcoming</li>
<li>Contact</li>
</ul>
</div>
</nav>
<div class="row">
<div class="student-profile">
<div class="col l8 offset-l2 m10 offset-m1">
<ul class="collapsible" popout" data-collapsible="accordion">
<li>
<div class="collapsible-header">Pefrsonal Info</div>
<div class="collapsible-body">
<div id="personal">
<div class="card black-text">
<div class="input-field col s12 m4 l4">
<input type="text" id="firstname" />
<label for="firstname">First Name:</label>
</div>
<div class="input-field col s12 l4 m4">
<input type="text" id="lastname" />
<label for="lastname">Last Name:</label>
</div>
<div class="input-field col s12 l4 m4">
<input type="text" id="surname" />
<label for="surname">Surname:</label>
</div>
<div class="input-field col s12 m6 l6">
<input type="text" id="father" />
<label for="father">Father Name:</label>
</div>
<div class="input-field col s12 l6 m6">
<input type="text" id="mother" />
<label for="mother">Mother Name:</label>
</div>
<div class="input-field col s12 m6 l6">
<input type="date" class="datepicker" />
</div>
</div>
</div>
</div>
</li>
<li>
<div class="collapsible-header">Academics Info</div>
<div class="collapsible-body"> Acaademics Should be here</div>
</li>
<li>
<div class="collapsible-header">Change Password</div>
<div class="collapsible-body">Password Change Shoule be here</div>
</li>
<li>
<div class="collapsible-header">View Data </div>
<div class="collapsible-body" id="dynamicdata">View Data</div>
</li>
</ul>
</div>
</div>
</div>
<style type="text/css">
<style type="text/css">
body {
background-color: #FCFCFC;
}
nav{
background-color: #33597C;
}
.updates{
position: absolute;
padding: 20px;
background: transparent;
}
marquee{
padding: 20px;
}
.vline{
width: 1px;
position: absolute;
background-color: orange;
}
.vline.medium{
top: initial;
height: 420px;
}
.small-login{
padding: 20px;
}
.login-fields{
padding: 20px;
}
h6{
color: #33597C;
}
h2 {
color: grey;
}
/* #4A6787 ; #33597C; */
.login-bg {
margin-top: 5%;
}
#message {
color: red;
margin: 20px;
}
#lgn_btn{
top: 20px;
background-color: #33597C;
width: 60%;
}
/* label focus color */
.input-field input[type=text]:focus + label {
color: #1A237E;
}
/* label underline focus color */
.input-field input[type=text]:focus {
border-bottom: 1px solid #1A237E;
box-shadow: 0 1px 0 0 #1A237E;
}
/* label focus color */
.input-field input[type=password]:focus + label {
color: #1A237E;
}
/* label underline focus color */
.input-field input[type=password]:focus {
border-bottom: 1px solid #1A237E;
box-shadow: 0 1px 0 0 #1A237E;
}
</style>
<script type="text/javascript">
jresp = '{% autoescape off%}{{jresp}}{% endautoescape%}';
resp = JSON.parse(jresp);
rollno = resp['rollno'];
details = resp['data'];
var update = document.getElementById('dynamicdata')
for (keys in details) {
update.innerHTML += "<b>"+keys[0].toUpperCase()+keys.slice(1).toLocaleLowerCase()+": </b>"+details[keys]+"<br />"
}
$('.datepicker').pickadate({
selectMonths: true,
selectYears: 15,
});
$(".button-collapse").sideNav();
$(document).ready(function () {
$('.collapsible').collapsible({
accordion: false // A setting that changes the collapsible behavior to expandable instead of the default accordion style
});
});
</script>
</body>
</html>
Well, after reading code, debugging and Googling I am able to fix the problem.
First thing - Materialize Collapsible.
Clicking on collapsible header, display property of collapsible body
is not changing.
So, adding display property for the element collapsible body, will fix the problem.
collapsible-body{
display: block;
}
`
Second thing - Materialize DatePicker
On Chrome, it is not responding to mouse clicks. But, responding to space button.
So, to fix this issue, I just added a bit of JQuery code as shown below.
Date Picker HTML Code
<div class="input-field col s12 m6 l6">
<label for="dob">Date of Birth:</label>
<input id="dob" type="text" class="datepicker" />
</div>
and mouse click event that triggers...
$('.datepicker').pickadate({
selectMonths: true,
selectYears: 40,
min: new Date(1990,0,1),
max: new Date(2000,11,31),
closeOnSelect: true,
});
$("#dob").click(function (event) {
event.stopPropagation();
$(".datepicker").first().pickadate("picker").open();
});
Here, you can see the working materialize date picker...
$('.datepicker').pickadate({
selectMonths: true,
selectYears: 40,
min: new Date(1990, 0, 1),
max: new Date(2000, 11, 31),
closeOnSelect: true,
});
$("#dob").click(function(event) {
event.stopPropagation();
$(".datepicker").first().pickadate("picker").open();
});
<head>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
</head>
<body>
<div class="input-field">
<label for="dob">Date of Birth:</label>
<input id="dob" type="date" class="datepicker" />
</div>
</body>

multiple forms JSF + primefaces 3.5

My question is similar like this one How to use <h:form> in JSF page? Single form? Multiple forms? Nested forms?, I have a main Page which has a panelMenu with menuitems, when I click in some menuitems, it refresh the middle part of my page called "centro" is like a template if I click in the "left content", only I want to refresh the "content".
I download a template but I wasn't in jsf so I create "layaout" inside that CSS template, but I have a form here that evaluates a case to redirect another page and show it in the middle of id "centro"
I have a problem in my middle page, which has other's forms. I read nest forms is not a valid concept but I need to redirect my page only in the middle, but when I run the project.
My button doesn't invoke my methods, but if I only run my middle page its works fine.
The nest forms are main which and the forms of my middle page, any help?
this is my main page
<h:form id="main" onsubmit="#{beanSec.setPer()}">
<p:layout style="height: 500px;" id="layout">
<p:layoutUnit position="west" resizable="false" size="188">
<p:menu style="width: 175px; border:0px ;background: #660000 ;">
<!-- puse width para el efecto cuando pasa el mouse no altere a los demas solo a este y paddin para alinearlo a mi gusto -->
<p:menuitem value="Interesados" update="centro"
ajax="false"
style="font-size:17px; padding-left: 32px; width: 80%"
action="#{navBean.setPaginaSecretaria('interesados')}" />
</p:menu>
<p:panelMenu style="width:180px;">
<p:submenu label="Académico">
<p:menuitem value="Matrícula"
style="color: black; font-weight: bold" update="centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('matricula')}" />
<p:menuitem value="Alumnos"
style="color:black ; font-weight: bold;" update="centro"
ajax="false" async="true"
action="#{navBean.setPaginaSecretaria('alumno')}" />
<p:menuitem value="Programación"
style="color: black ; font-weight: bold" update="centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('programacion')}" />
<p:menuitem value="Cursos"
style="color:black ; font-weight: bold;" update="centro"
ajax="false" url="ListarCursos.xhtml" />
<!--action="{navBean.setPaginaSecretaria('cursos')}"-->
<p:menuitem value="Docentes"
style="color:black ; font-weight: bold;" update="centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('docente')}" />
<p:menuitem value="Laboratorios"
style="color:black ; font-weight: bold ;" update="centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('laboratorio')}" />
</p:submenu>
</p:panelMenu>
<p:panelMenu style="width:180px;">
<p:submenu label="Recaudación">
<p:menuitem value="Cuentas Bancarias"
style="color:black ; font-weight: bold" update="centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('cuentas')}" />
<p:menuitem value="Pagos"
style="color:black; font-weight: bold;" update="centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('pagos')}" />
</p:submenu>
</p:panelMenu>
<p:panelMenu style="width:180px;">
<p:submenu label="Acreditaciones">
<p:menuitem value="Convenios"
style="color:black ; font-weight: bold" update="centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('convenios')}" />
<p:menuitem value="Certificaciones"
style="color:black; font-weight: bold;" update="centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('certificaciones')}" />
</p:submenu>
</p:panelMenu>
<p:panelMenu style="width:180px;">
<p:submenu label="Eventos y noticias">
<p:menuitem value="Eventos"
style="color: black ; font-weight: bold" update="centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('eventos')}" />
<p:menuitem value="Noticias"
style="color: black ; font-weight: bold" update="centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('noticias')}" />
</p:submenu>
</p:panelMenu>
<!-- puse width para el efecto cuando pasa el mouse no altere a los demas solo a este y paddin para alinearlo a mi gusto -->
<p:menu style="width: 175px; border:0px ;background:#660000;">
<p:menuitem value="Datos Personales" update="centro"
style="font-size:17px; padding-left: 32px; width: 80%;"
ajax="false"
action="#{navBean.setPaginaSecretaria('datos')}" />
</p:menu>
</p:layoutUnit>
<p:layoutUnit position="center" id="centro"
style="padding-left: 20px">
<c:if test="#{navBean.paginaSecretaria eq 'interesados'}">
<ui:include src="ListarInteresados.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'matricula'}">
<ui:include src="Matricula.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'alumno'}">
<ui:include src="ListarAlumnos.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'programacion'}">
<ui:include src="ListarProgramacion.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'cursos'}">
<ui:include src="ListarCursos.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'docente'}">
<ui:include src="ListarDocentes.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'laboratorio'}">
<ui:include src="ListarLaboratorios.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'cuentas'}">
<ui:include src="CuentasBancarias.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'pagos'}">
<ui:include src="Pagos.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'convenios'}">
<ui:include src="ListarConvenios.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'certificaciones'}">
<ui:include src="ListarCertificaciones.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'eventos'}">
<ui:include src="ListarEventos.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'noticias'}">
<ui:include src="ListarNoticias.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'datos'}">
<ui:include src="DatosPersonalesSecretaria.xhtml" />
</c:if>
</p:layoutUnit>
</p:layout>
</h:form>
this is my middle page
<h:form>
<p:dataTable id="dt1" value="#{DAOCurso.listarTodosCursos()}"
var="datos">
<f:facet name="header">Listado de Cursos</f:facet>
<p:column filterBy="#{datos.nombre}"
filterMatchMode="contains">
<f:facet name="header">
<h:outputLabel value="Curso" />
</f:facet>
<h:outputText value="#{datos.nombre}" style="color: black">
</h:outputText>
</p:column>
<p:column filterBy="#{datos.siglas}"
filterMatchMode="contains">
<f:facet name="header">
<h:outputLabel value="Siglas" />
</f:facet>
<h:outputText value="#{datos.siglas}" style="color: black">
</h:outputText>
</p:column>
<p:column filterBy="#{datos.certificacion.nombre}"
filterMatchMode="contains">
<f:facet name="header">
<h:outputLabel value="Certificación" />
</f:facet>
<h:outputText value="#{datos.certificacion.nombre}"
style="color: black"></h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputLabel value="Modificar" />
</f:facet>
<p:commandLink value="Modificar" oncomplete="dlg2.show();"
update=":main:modalDialog2" style="color: black"
action="#{beanCurso.traerDatos()}">
<f:setPropertyActionListener target="#{beanCurso.codigo}"
value="#{datos.codigo}" />
</p:commandLink>
</p:column>
</p:dataTable>
</h:form>
<p:dialog id="modalDialog2" header="Modificar Datos Personales"
widgetVar="dlg2" dynamic="true">
<h:form id="form2">
<table>
<tr>
<td>
<h:outputLabel value="Nombre Curso" />
<p:inputText id="nombre" value="#{beanCurso.nombre}" />
</td>
</tr>
<tr>
<td>
<h:outputLabel value="Siglas" />
<p:inputText value="#{beanCurso.siglas}" />
</td>
</tr>
<tr>
<td>
<h:outputLabel value="Certificación" />
<p:selectOneMenu id="cboCentro"
value="#{beanCurso.certificacion.codigo}" required="true"
requiredMessage="Debe seleccionar una certificacion">
<f:selectItem itemLabel="Seleccione Certificacion"
id="cert" />
<f:selectItems value="#{DAOCert.listaCertificaciones()}"
id="combocert" var="cert" itemValue="#{cert.codigo}"
itemLabel="#{cert.nombre}" />
</p:selectOneMenu>
</td>
</tr>
<tr>
<td>
<p:selectBooleanCheckbox value="#{beanCurso.vigencia}" />
<h:outputText value="Vigencia"
style="font-weight:bold" />
</td>
</tr>
<tr>
<td>
<p:commandButton value="Modificar"
action="#{DAOCurso.modificarCurso()}" ajax="false" />
</td>
</tr>
</table>
</h:form>
</p:dialog>
<p />
<h:form>
<p:commandButton value="Agregar" oncomplete="dlg.show();" />
<p:dialog header="Datos Personales" widgetVar="dlg"
resizable="false" id="dialogo" dynamic="true">
<table>
<tr>
<td>
<h:outputLabel value="Nombre Curso" />
<p:inputText id="nombre" value="#{beanCurso.nombre}" />
</td>
</tr>
<tr>
<td>
<h:outputLabel value="Siglas" />
<p:inputText value="#{beanCurso.siglas}" />
</td>
</tr>
<tr>
<td>
<h:outputLabel value="Certificación" />
<p:selectOneMenu value="#{beanCurso.codCert}"
required="true"
requiredMessage="Debe seleccionar una certificacion">
<f:selectItem itemLabel="Seleccione Certificacion"
id="cert" itemValue="" />
<f:selectItems value="#{DAOCert.listaCertificaciones()}"
id="combocert" var="cert" itemValue="#{cert.codigo}"
itemLabel="#{cert.nombre}" />
</p:selectOneMenu>
</td>
</tr>
<tr>
<td>
<h:commandButton value="Registrar Curso"
action="#{DAOCurso.insertarCurso()}" />
</td>
</tr>
</table>
</p:dialog>
</h:form>
As Luiggi said, you should split your main form into multiple forms:
<p:layout style="height: 500px;" id="layout">
<p:layoutUnit position="west" resizable="false" size="188">
<h:form id="main" onsubmit="#{beanSec.setPer()}">
<p:menu style="width: 175px; border:0px ;background: #660000 ;">
<!-- puse width para el efecto cuando pasa el mouse no altere a los demas solo a este y paddin para alinearlo a mi gusto -->
<p:menuitem value="Interesados" update=":centro"
ajax="false"
style="font-size:17px; padding-left: 32px; width: 80%"
action="#{navBean.setPaginaSecretaria('interesados')}" />
</p:menu>
<p:panelMenu style="width:180px;">
<p:submenu label="Académico">
<p:menuitem value="Matrícula"
style="color: black; font-weight: bold" update=":centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('matricula')}" />
<p:menuitem value="Alumnos"
style="color:black ; font-weight: bold;" update=":centro"
ajax="false" async="true"
action="#{navBean.setPaginaSecretaria('alumno')}" />
<p:menuitem value="Programación"
style="color: black ; font-weight: bold" update=":centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('programacion')}" />
<p:menuitem value="Cursos"
style="color:black ; font-weight: bold;" update=":centro"
ajax="false" url="ListarCursos.xhtml" />
<!--action="{navBean.setPaginaSecretaria('cursos')}"-->
<p:menuitem value="Docentes"
style="color:black ; font-weight: bold;" update=":centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('docente')}" />
<p:menuitem value="Laboratorios"
style="color:black ; font-weight: bold ;"
update=":centro" ajax="false"
action="#{navBean.setPaginaSecretaria('laboratorio')}" />
</p:submenu>
</p:panelMenu>
<p:panelMenu style="width:180px;">
<p:submenu label="Recaudación">
<p:menuitem value="Cuentas Bancarias"
style="color:black ; font-weight: bold" update=":centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('cuentas')}" />
<p:menuitem value="Pagos"
style="color:black; font-weight: bold;" update=":centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('pagos')}" />
</p:submenu>
</p:panelMenu>
<p:panelMenu style="width:180px;">
<p:submenu label="Acreditaciones">
<p:menuitem value="Convenios"
style="color:black ; font-weight: bold" update=":centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('convenios')}" />
<p:menuitem value="Certificaciones"
style="color:black; font-weight: bold;" update=":centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('certificaciones')}" />
</p:submenu>
</p:panelMenu>
<p:panelMenu style="width:180px;">
<p:submenu label="Eventos y noticias">
<p:menuitem value="Eventos"
style="color: black ; font-weight: bold" update=":centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('eventos')}" />
<p:menuitem value="Noticias"
style="color: black ; font-weight: bold" update=":centro"
ajax="false"
action="#{navBean.setPaginaSecretaria('noticias')}" />
</p:submenu>
</p:panelMenu>
<!-- puse width para el efecto cuando pasa el mouse no altere a los demas solo a este y paddin para alinearlo a mi gusto -->
<p:menu style="width: 175px; border:0px ;background:#660000;">
<p:menuitem value="Datos Personales" update=":centro"
style="font-size:17px; padding-left: 32px; width: 80%;"
ajax="false"
action="#{navBean.setPaginaSecretaria('datos')}" />
</p:menu>
</h:form>
</p:layoutUnit>
<!-- Since you have a form inside each included xhtml file, you don't need following code to be inside the main form-->
<p:layoutUnit position="center" id="centro"
style="padding-left: 20px">
<c:if test="#{navBean.paginaSecretaria eq 'interesados'}">
<ui:include src="ListarInteresados.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'matricula'}">
<ui:include src="Matricula.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'alumno'}">
<ui:include src="ListarAlumnos.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'programacion'}">
<ui:include src="ListarProgramacion.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'cursos'}">
<ui:include src="ListarCursos.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'docente'}">
<ui:include src="ListarDocentes.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'laboratorio'}">
<ui:include src="ListarLaboratorios.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'cuentas'}">
<ui:include src="CuentasBancarias.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'pagos'}">
<ui:include src="Pagos.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'convenios'}">
<ui:include src="ListarConvenios.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'certificaciones'}">
<ui:include src="ListarCertificaciones.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'eventos'}">
<ui:include src="ListarEventos.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'noticias'}">
<ui:include src="ListarNoticias.xhtml" />
</c:if>
<c:if test="#{navBean.paginaSecretaria eq 'datos'}">
<ui:include src="DatosPersonalesSecretaria.xhtml" />
</c:if>
</p:layoutUnit>
</p:layout>
Last remark, you should avoid using JSTL with JSF, try to use rendered attribute instead.

Fancybox 2.0 not loading

I been looking and working and I can't make fancybox work in this code. I have revised severalt times and I don't understand why it doesn't work. I'm using Dreamweaver and the fancybox are marked below and I don't know if some code contrasts with the fancybox codes
<!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"><!-- InstanceBegin template="/Templates/GabLopezIT.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<link rel="shortcut icon" type="image/x-icon" href="../images/favicon.ico" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Gabriele Lopez</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<style type="text/css">
-->
</style>
<link href="../css/psr_site_layout.css" rel="stylesheet" type="text/css" />
<link href="../css/psr_site_layout_content.css" rel="stylesheet" type="text/css" />
<link href="../css/psr_site_layout_gallery.css" rel="stylesheet" type="text/css" />
<link href="../css/psr_site_submenu.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
/*.video {
width:200px;
float:left;
margin-left:50px;
}*/
</style>
<!-- InstanceEndEditable -->
<style type="text/css">
</style>
<style type="text/css">
body,td,th {
color: #FFF;
}
a:link {
color: #CCC;
text-decoration: none;
}
a:visited {
color: #CCC;
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
#bio {
margin-bottom:-20px;
}
#social {
margin-top:5px;
height: 25px;
width: auto;
float: right;
}
#lang {
float:left;
width:auto;
margin-right:15px;
}
#twitter {
float: right;
width: 60px;
height: 24px;
vertical-align: bottom;
margin-left: 17px;
margin-right: 5px;
}
#google {
float: right;
width: 50px;
height: 24px;
vertical-align: bottom;
margin-left: 17px;
margin-right: 15px;
}
.fb-like {
height: 25px;
width: 85px;
float: right;
vertical-align: bottom;
margin-left: 17px;
margin-right: 5px;
display:inline-table
}
</style>
<link href="../css/copyright.css" rel="stylesheet" type="text/css" />
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<link href="../css/bottom.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="#666666" background="../img/background001.jpg" onload="MM_preloadImages('../images/facebook2.png')">
<!-- FACEBOOK CODE-->
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "http://connect.facebook.net/it_IT/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!--END FACEBOOK CODE-->
<!--TWITTER CODE-->
<script>!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){
js=d.createElement(s);js.id=id;
js.src="//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);}
}(document,"script","twitter-wjs");</script>
<!--END TWITTER CODE-->
<!--GOOGLE+ CODE-->
<script type="text/javascript">
window.___gcfg = {lang: 'it'};
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<!--END GOOGLE+ CODE-->
<div id="psr_site_layout">
<table id="Table_01" width="800" align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../img/bannerweb.png" alt="" width="800" height="200" border="0" /></td>
</tr>
<tr>
<td colspan="5">
<img src="../img/layout/PSR-website-(sliced-new)_03.png" width="800" height="8" alt="" /></td>
</tr>
<tr>
<td colspan="5"><ul id="MenuBar1" class="MenuBarHorizontal">
<li>HOME</li>
<li>NEWS</li>
<li>TOUR</li>
<li>FOTOS</li>
<li>VIDEOS</li>
<li>ALBUMS</li>
<li>BIO</li>
</ul>
<div id="social">
<div id="lang"><img src="../img/EN-button.png" width="20" height="20" /></div>
<div id="google"><g:plusone size="medium"></g:plusone>
</div>
<div id="twitter">Tweet</div>
<div class="fb-like" data-href="http://www.gabrielelopez.com" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false" data-font="trebuchet ms"></div>
</div>
</td>
</tr>
<tr>
<td colspan="5">
<img src="../img/layout/PSR-website-(sliced-new)_15.jpg" width="800" height="6" alt="" /></td>
</tr>
<tr>
<td colspan="5"><!-- InstanceBeginEditable name="Content1" -->
Fancybox Scripts start here
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="fancybox/source/jquery.fancybox.pack.js?v=2.0.4"></script>
<script type="text/javascript" src="fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-buttons.js?v=2.0.4"></script>
<script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-thumbs.js?v=2.0.4"></script>
<link rel="stylesheet" href="/fancybox/source/jquery.fancybox.css?v=2.0.4" type="text/css" media="screen" />
<link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-buttons.css?v=2.0.4" type="text/css" media="screen" />
<link rel="stylesheet" href="/fancybox/source/helpers/jquery.fancybox-thumbs.css?v=2.0.4" type="text/css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$(".various").fancybox({
maxWidth : 800,
maxHeight : 600,
fitToView : false,
width : '70%',
height : '70%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',
});
});
</script>
<div id="psr_site_layout_content">
Fancybox HTML content starts here
<a class="various fancybox.iframe" href="http://www.youtube.com/embed/_DjiHFxPauw" title="Vorrei tanto dirtelo"><img src="../img/tvpianeta.png"></a><p>Vorrei tanto dirtelo</p>
<a class="various fancybox.iframe" href="http://www.youtube.com/embed/L9szn1QQfas?autoplay=1">Youtube (iframe)</a>
<div class="video"><a class="various fancybox.iframe" href="http://www.youtube.com/embed/_DjiHFxPauw" title="Vorrei tanto dirtelo"><img src="../img/tvvorrei.png"></a><p>Vorrei tanto dirtelo</p></div>
<div class="video"><a class="lavita fancybox.iframe" href="http://www.youtube.com/embed/_DjiHFxPauw" title="Vorrei tanto dirtelo"><img src="../img/tvvita.png"></a>
<p>La vita che vorrei</p></div>
<div class="video"><a class="lavita fancybox.iframe" href="http://www.youtube.com/embed/_DjiHFxPauw" title="Vorrei tanto dirtelo"><img src="../img/tvhistoria.png"></a><p>Historia de un perfecto idiota</p></div>
<div class="video"><a class="lavita fancybox.iframe" href="http://www.youtube.com/embed/_DjiHFxPauw" title="Vorrei tanto dirtelo"><img src="../img/tvteletaxi.png"></a><p>Vorrei tanto dirtelo</p></div>
</div>
<!-- InstanceEndEditable --></td>
</tr>
<div id="bottom">
<tr>
<td colspan="5">
<img src="../img/layout/PSR-website-(sliced-new)_17.jpg" width="800" height="5" alt="" /></td>
</tr>
<tr>
<td colspan="6"><div id="psr_site_submenu">Home | News | Tour | Fotos | Videos | Dischi | Bio | Cambia al Inglese</div></td>
</tr>
<tr>
<td height="39" colspan="6" class="copyright">
© 2012 Orange Park Records srl.<br />
Tutti diritti riservati.
</td>
</tr>
</div>
</table>
</div>
<p> </p>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
<!-- InstanceEnd --></html>
I don't see anywhere in your code that you have included jQuery or fancybox's css and js files.
Be sure that you have included the script and stylesheet in your document (make sure the css and js files are on your server). Make sure you also load the jQuery library.
Follow this example and adjust the paths accordingly:
<!-- Add jQuery library -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!-- Add fancyBox -->
<link rel="stylesheet" href="/fancybox/source/jquery.fancybox.css?v=2.0.4" type="text/css" media="screen" />
<script type="text/javascript" src="/fancybox/source/jquery.fancybox.pack.js?v=2.0.4"></script>