Dúvida com rich:listShuttle

2 respostas
ralphsilver

Galera,

Já tentei de tudo mas não obtive sucesso... esse rich:listShuttle não funciona por nada.. já fui em todos os fóruns inclusive do próprio guj que já resolveu o problema.....

ele me retorna tal problema:

"Component formTipoContrato:listShuttleUnidade has invalid value expression br.edu.unianhanguera.siae.entity.UnidadeEntity@cb289ce6"

já implementei hashCode e equals na entidade, já utilizei o a4j:keepAlive no bean, já coloquei todos os beans como session mas nada...

segue a página:

<rich:listShuttle sourceValue="#{templateBean.allUnidade}" id="listShuttleUnidade"
                                              targetValue="#{template.unidade}" var="items" listsHeight="300"
                                              sourceListWidth="300" targetListWidth="260" sourceCaptionLabel="Unidades para associação"
                                              targetCaptionLabel="Unidades associadas" converter="unidadeConverter">
                                <rich:column>
                                    <h:outputText value="#{items.dcCursoNet}"></h:outputText>
                                </rich:column>
                            </rich:listShuttle>
                            <h:outputLabel styleClass="labelForm" >
                                <rich:message for="listShuttleUnidade" />
                            </h:outputLabel>
                            <a4j:keepAlive id="keepAliveTemplate" beanName="template" />
segue o converter:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.edu.unianhanguera.util.converter;

import br.edu.unianhanguera.siae.entity.UnidadeEntity;

import javax.faces.component.UIComponent;

import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

/**
 *
 * @author rhumberto
 */
public class ListShuttleUnidade implements Converter {

    @Override
    public Object getAsObject(FacesContext facesContext, UIComponent uIComponent, String valorTela) {
        if (valorTela == null) {
            return null;
        }

        UnidadeEntity unidade = new UnidadeEntity();
        unidade.setSgUnidade(valorTela);

        return unidade;

    }

    @Override
    public String getAsString(FacesContext facesContext, UIComponent uIComponent, Object objetoTela) {
        if (objetoTela == null) {
            return null;
        }

        if (objetoTela instanceof UnidadeEntity) {
            UnidadeEntity unidade = (UnidadeEntity) objetoTela;
            return unidade.getSgUnidade();

        } else {

            throw new IllegalArgumentException("object:" + objetoTela + "of type:" + objetoTela.getClass().getName());

        }
    }
}

lembrando que já setei o converter no faces-config.xml

Se alguém puder me ajudar.... desde já agradeço...

2 Respostas

ralphsilver

outra coisa que esqueci de falar: já debbuguei e me parece que ele passar exato no converter…

ViniciusNaka

ralphsilver, to ah um certo tempo tentando resolver isso aqui. Vc conseguiu resolver?
abs

Criado 3 de março de 2010
Ultima resposta 30 de nov. de 2011
Respostas 2
Participantes 2