Bom dia pessoal.
Tenho projeto maven com um aplicativo pai e alguns aplicativos filhos. No aplicativo pai, tenho uma pagina index.xhtml, nesta pagina, tenho duas frames: a esquerda (left), contento nome de usuário, empresa e a lista de aplicativos aos quais o usuário tem acesso e a direita (main) a frame a qual o aplicativo selecionado deverá ser aberto.
O problema, é que ao selecionar o aplicativo na frame esquerda, a frame da direita não está sendo atualizada automaticamente. Quando dou um refresh pelo IE com o aplicativo já selecionado, ele é carregado.
Ao que percebi, o update="@this" do ajax recarrega somente a pagina da frame da esquerda.
index.xhtml:
<?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:h="http://java.sun.com/jsf/html">
<h:head>
<title>jvmsoftware</title>
</h:head>
<frameset rows="*" cols="230,*" framespacing="1" frameborder="yes" border="1" bordercolor="#666666">
<frame src="faces/frameLeft.xhtml" name="leftFrame" scrolling="yes" noresize="noresize" id="leftFrame" title="leftFrame" />
<frame src="faces/frameMain.xhtml" name="mainFrame" scrolling="yes" noresize="noresize" id="mainFrame" title="mainFrame" />
</frameset>
<noframes>
<body style=" font-family: arial; background-color: activeborder">
</body>
</noframes>
</html>
frameLeft.xhtml:
<?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:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>frame left</title>
</h:head>
<h:body style=" font-family: arial; background-color: activeborder">
<div align="center">
<img src="images/jvmsoftware.jpg"/>
</div>
<h:form>
<div align="center">
<p:messages/>
<p:panelGrid style="width: 180px; background-color: activecaption" id="login" columns="1">
<p:outputLabel style="width: 150px; font-size: 10px" for="user" value="usuario:"/>
<p:inputText disabled="true" style="width: 150px; font-size: 10px" id="user" value="#{loginBean.usuario.username}"/>
<p:outputLabel style="width: 150px; font-size: 10px" for="empresa" value="empresa:"/>
<p:inputText disabled="true" style="width: 150px; font-size: 10px" id="empresa" value="#{loginBean.rel.empresa.nomeFantasia}"/>
</p:panelGrid>
</div>
<div align="center">
<p:panelGrid style="width: 180px; background-color: activecaption" id="aplic" columns="1">
<div align="center">
<p:outputLabel style="font-weight: bolder; width: 150px; font-size: 12px" for="ap" value="SELEÇÃO DE APLICATIVO"/>
</div>
<div align="left">
<p:selectOneListbox id="ap" style="font-size: 10px; width: 150px; height: 200px"
value="#{loginBean.selectedAplicativo}" converter="aplicativosConversor">
<f:selectItems var="apl" value="#{loginBean.listAplicativos}" itemValue="#{apl.label}"/>
<p:ajax event="change" update="@this" listener="#{loginBean.trocaAplicativo}"/>
</p:selectOneListbox>
</div>
</p:panelGrid>
</div>
</h:form>
</h:body>
</html>
frameMain.xhtml:
<?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:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>frame main</title>
</h:head>
<h:body style="font-family: arial; background-color: activeborder">
<h:form>
frame main
<ui:include src="#{loginBean.aplicativoCorrente.caminho}"/>
</h:form>
</h:body>
</html>
metodo trocaAplicativo do bean:
public String trocaAplicativo(AjaxBehaviorEvent e){
if (aplicativoCorrente == null) {
setAplicativoCorrente(selectedAplicativo);
logged = "index.xhtml";
} else {
logged = "index.xhtml";
}
msg=null;
Logger.getLogger(LoginBean.class.getName()).log(Level.INFO, "aplicativo corrente: {0}", aplicativoCorrente.getNomeAplicativo());
Logger.getLogger(LoginBean.class.getName()).log(Level.INFO, "aplicativo selecionado: {0}", selectedAplicativo.getNomeAplicativo());
return logged;
}
Alguma idéia de como posso recarregar a main quando selecionar o aplicativo?