Problema com <rich:panelMenu> e Ajax para atualização de painel

1 resposta
M

Tenho um layout padrão: menu, cabeçalho, rodapé e conteúdo. Estou utilizando Facelets/RichFaces e o componente panelMenu.
Quando eu clico no menu o painel não é atualizado. Vi um problema parecido e tentei utilizar a solução, mas não funciona.
Gostaria da ajuda de vocês para resolver o problema.

Segue os códigos:

menu.xhtml

&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;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:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets"&gt;
&lt;head&gt;
&lt;link href="./css/menu.css" rel="stylesheet" type="text/css" /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h:form id="form1"&gt;
&lt;f:subview id="subMenu"&gt;
&lt;h:panelGrid columns="2" columnClasses="cols" width="100%"&gt;
&lt;rich:panelMenu style="width:186px" mode="ajax"
iconExpandedGroup="disc" iconCollapsedGroup="disc"
iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right"
iconCollapsedTopGroup="chevronDown" iconCollapsedTopPosition="right" &gt;
&lt;rich:panelMenuGroup id="grpCadastro" label="Cadastro"&gt;
&lt;rich:panelMenuItem label="Cliente" action="#{menu.getCorrente}"&gt;
&lt;a4j:keepAlive beanName="menu" /&gt;
&lt;f:param name="corrente" value="frmCliente.xhtml"/&gt;
&lt;/rich:panelMenuItem&gt;
&lt;rich:panelMenuItem id="Item_1_2" label="Cidade" action="#{menu.corrente}"&gt;
&lt;f:param name="current" value="Item 1.2"/&gt;
&lt;/rich:panelMenuItem&gt;
&lt;rich:panelMenuItem id="Item_1_3" label="Usuário" action="#{panelMenu.updateCurrent}"&gt;
&lt;f:param name="current" value="Item 1.3"/&gt;
&lt;/rich:panelMenuItem&gt;
&lt;/rich:panelMenuGroup&gt;
&lt;rich:panelMenuGroup id="grpOperacoes" label="Operações"&gt;
&lt;rich:panelMenuItem id="Item_2_1" label="Vendas" action="#{panelMenu.updateCurrent}"&gt;
&lt;f:param name="current" value="Item 2.1"/&gt;
&lt;/rich:panelMenuItem&gt;
&lt;rich:panelMenuItem id="Item_2_2" label="Orçamento" action="#{panelMenu.updateCurrent}"&gt;
&lt;f:param name="current" value="Item 2.2"/&gt;
&lt;/rich:panelMenuItem&gt;
&lt;rich:panelMenuGroup label="Group 2.4"&gt;
&lt;rich:panelMenuItem id="Item_2_4_1" label="Item 2.4.1" action="#{panelMenu.updateCurrent}"&gt;
&lt;f:param name="current" value="Item 2.4.1"/&gt;
&lt;/rich:panelMenuItem&gt;
&lt;/rich:panelMenuGroup&gt;
&lt;rich:panelMenuItem id="Item_2_5" label="Item 2.5" action="#{panelMenu.updateCurrent}"&gt;
&lt;f:param name="current" value="Item 2.5"/&gt;
&lt;/rich:panelMenuItem&gt;
&lt;/rich:panelMenuGroup&gt;
&lt;rich:panelMenuGroup id="Group3" label="Group 3"&gt;
&lt;rich:panelMenuItem id="Item_3_1" label="Item 3.1" action="#{panelMenu.updateCurrent}"&gt;
&lt;f:param name="current" value="Item 3.1"/&gt;
&lt;/rich:panelMenuItem&gt;
&lt;rich:panelMenuItem id="Item_3_2" label="Item 3.2" action="#{panelMenu.updateCurrent}"&gt;
&lt;f:param name="current" value="Item 3.2"/&gt;
&lt;/rich:panelMenuItem&gt;
&lt;rich:panelMenuItem id="Item_3_3" label="Item 3.3" action="#{panelMenu.updateCurrent}"&gt;
&lt;f:param name="current" value="Item 3.3"/&gt;
&lt;/rich:panelMenuItem&gt;
&lt;/rich:panelMenuGroup&gt;
&lt;/rich:panelMenu&gt;
&lt;rich:panel&gt;
&lt;a4j:outputPanel ajaxRendered="true"&gt;
&lt;h:outputText value="#{menu.corrente} selected" id="current"/&gt;
&lt;/a4j:outputPanel&gt;
&lt;/rich:panel&gt;
&lt;/h:panelGrid&gt;
&lt;/f:subview&gt;
&lt;/h:form&gt;
&lt;/body&gt;
&lt;/html&gt;

o código da xhtml - principal

&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; ?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets"&gt;

&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /&gt;
&lt;title&gt;Insert title here &lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;ui:composition template="modelo.xhtml"&gt;
&lt;ui:define name="menu"&gt;
&lt;ui:include src="menu.xhtml" /&gt;
&lt;/ui:define&gt;
&lt;ui:define name="conteudo"&gt;
&lt;a4j:outputPanel ajaxRendered="true"&gt;
&lt;a4j:include viewId="#{menu.corrente}"/&gt;
&lt;/a4j:outputPanel&gt;

&lt;/ui:define&gt;
&lt;ui:define name="rodape"&gt;Desenvolvido por: Woodpecker&lt;/ui:define&gt;
&lt;/ui:composition&gt;
&lt;/body&gt;
&lt;/html&gt;

Bean

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.appbcs.view;

/**
*
* @author neves
*/
public class menu {

private String corrente;

/** Creates a new instance of menu */
public menu() {
this.setCorrente("frmPadrao.xhtml");
}

/**
* @return the corrente
*/
public String getCorrente() {
return corrente;
}

/**
* @param corrente the corrente to set
*/
public void setCorrente(String corrente) {
this.corrente = corrente;
}
}

1 Resposta

M

Pessoal, alguém tem um exemplo parecido ?

Criado 12 de abril de 2009
Ultima resposta 13 de abr. de 2009
Respostas 1
Participantes 1