Erro ao usar reRender no rich:menuItem

3 respostas
rmomogi

Montei um menu dinamico que é baseado nas tabelas do meu banco, mas ao usar o action ele deveria preencher o divCorpo,
mas dá o seguinte erro:

Target component for id divCorpo not found

Não sei o que faço. Help-me…

Código da página

<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
    <ui:composition template="../layout/template.xhtml">
        <ui:define name="menu">
            <h:form>
                <rich:toolBar>
                    <c:forEach items="#{LoginBean.userVO.modules}" var="module">
                        <rich:dropDownMenu>
                            <f:facet name="label">
                                <h:panelGroup>
                                    <h:graphicImage value="/images/icons/copy.gif" styleClass="pic"/>
                                    <h:outputText value="${module.name}"/>
                                </h:panelGroup>
                            </f:facet>

                            <!-- Sub Menu -->
                            <c:forEach items="${module.subModuleVO}" var="menu">
                                <rich:menuItem submitMode="ajax"
                                               value="${menu.action}"
                                               reRender="divCorpo"
                                               action="#{navigation.open}"
                                               icon="layout/images/icons/${menu.icon}">
                                    <a4j:actionparam name="url" value="${menu.action}"/>
                                </rich:menuItem>
                            </c:forEach>
                        </rich:dropDownMenu>
                    </c:forEach>
                </rich:toolBar>
            </h:form>
        </ui:define>


        <ui:define name="profile">
            <!-- Dados do usuário -->
            <div id="destaque" class="destaque">
                <br><h:graphicImage url="layout/images/icons/user.png"/> &nbsp; Usuário: #{LoginBean.userVO.email}</br>
                <br>Nível: #{LoginBean.userVO.perfil.descricao}</br>
                <br>
                    <h:outputLink action="#{LoginBean.logoff}">
                        Sair do sistema &nbsp;
                    </h:outputLink>
                    <!--
                    &nbsp; &nbsp; &nbsp;<h:graphicImage url="layout/images/icons/door_out.png"/>
                    -->
                </br>
            </div>
        </ui:define>
        
        <!-- Corpo -->
        <a4j:form>
            <f:view>
                <ui:define name="body">
                    <div id="divCorpo">
                        <a4j:include viewId="#{navigation.url}"></a4j:include>
                    </div>
                </ui:define>
            </f:view>
        </a4j:form>
    </ui:composition>
</html>

Classe Bean para navegação.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cvhnet.util;

import javax.faces.context.FacesContext;

/**
 *
 * @author rmoraes
 */
public class Navigation {

    private String url = "/pages/index.xhtml";

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String open() {
        String url = (String) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("url");
        setUrl(url);
        return "";
    }
}

3 Respostas

Kleber-rr

Eae man, conseguiu resolver seu problema??

Fernando_H_Gomes

n tou conseguindo perceber, mas tenta testar…
tenta tirar as tags jsf…
criar sua div fora do form… fora da view…

Kleber-rr

Fernando H. Gomes:
n tou conseguindo perceber, mas tenta testar…
tenta tirar as tags jsf…
criar sua div fora do form… fora da view…

Exatamente, cria sua div fora do form que resolve.
Flws

Criado 13 de agosto de 2009
Ultima resposta 31 de jan. de 2010
Respostas 3
Participantes 3