Gente.
Eu tenho uma pagina(index2.jsp) que chama uma outra página dentro dela(home.jsp).
index2.jsp:
1. <?xml version="1.0" encoding="ISO-8859-1"?>
2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3. <html xmlns="http://www.w3.org/1999/xhtml"
4. xmlns:ui="http://java.sun.com/jsf/facelets"
5. xmlns:h="http://java.sun.com/jsf/html"
6. xmlns:f="http://java.sun.com/jsf/core"
7. xmlns:a4j="http://richfaces.org/a4j"
8. xmlns:rich="http://richfaces.org/rich"
9. xmlns:p="http://primefaces.prime.com.tr/ui">
10.
11. <head>
12. <title>Title</title>
13. <meta content='text/html; charset=ISO-8859-1' http-equiv='Content-Type'/>
14. <p:resources/>
15.
16. </head>
17. <body>
18. <f:view>
19. <!-- Carrega o templante montado na outra pagina -->
20. <ui:composition template="template.xhtml">
21. <!-- Carrega a parte CABECALHO do template -->
22. <ui:define name="header" >
23. .
24. .
25. .
26. </ui:define>
27.
28. <!-- Carrega a parte Lateral do template (tree)-->
29. <ui:define name="tree">
30. .
31. .
32. .
33. </ui:define>
34.
35. <!-- Carrega a parte Central do template (conteudo)-->
36. <ui:define name="content">
37. <a4j:include viewId="#{url.url}" style="margin:0;padding:0;"/> ---------------------------------> Aqui eu chamo minha home.jsp
38. </ui:define>
39.
40. <!-- Carrega a parte do RODAPE do template -->
41. <ui:define name="bottom">
42. <ui:include src="pageFooter.jsp" />
43. </ui:define>
44. </ui:composition>
45. </f:view>
46. </body>
47. </html>
home.jsp
<?xml version="1.0" encoding="ISO-8859-1"?>
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:p="http://primefaces.prime.com.tr/ui">
<head>
<title>Home</title>
<script type='text/javascript'>
function atualiza(){
var altura = window.innerHeight;
document.getElementById("panel2").style.height= (altura/2)+"px";
}
</script>
</head>
<body onload="atualiza()">
<h:form prependId="false">
<h:panelGrid id="homeGrid" columns="2" width="100%" cellpadding="8px" >
<p:panel id="panel1" style="width:auto;max-width:680px;min-width:420px;overflow:auto;">
<f:facet name="header">
<h:outputText value="Panel1" />
</f:facet>
</p:panel>
<p:panel id="panel2" style="width:auto;max-width:680px;min-width:420px;overflow:auto; ">
<f:facet name="header">
<h:outputText value="Panel2" />
</f:facet>
<a4j:include viewId="panel2.jsp"/>
</p:panel>
<p:panel id="panel3" style="width:auto;max-width:680px;min-width:420px;overflow:auto;">
<f:facet name="header">
<h:outputText value="Panel3" />
</f:facet>
<ui:include src="panel3.jsp"/>
</p:panel>
<p:panel id="panel4" style="width:auto;max-width:680px;min-width:420px;overflow:auto;">
<f:facet name="header">
<h:outputText value="Panel4" />
</f:facet>
<ui:include src="panel4.jsp"/>
</p:panel>
</h:panelGrid>
</h:form>
</body>
</html>
Quando eu coloco no browser pra rodar minha home.jsp, ela roda certinho, setando a altura do meu panel do jeito que o script manda, mas quando eu mando rodar o index.jsp, a altura do meu panel não é setada, e lá no meu console de erros fala que panel2 é null!
Alguém sabe o que pode ser feito???
já tentei colocar o script na index.jsp no template e nada…
vlw!!!